-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplotTest.m
More file actions
43 lines (37 loc) · 1010 Bytes
/
plotTest.m
File metadata and controls
43 lines (37 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
clf
clear all
hold on
width = 18; %cm
length1 = 29; %cm
depth = 12.5; %cm
n = 1.5;
theta = linspace(0.001, pi, 88);
comDepth = -6.5/100;
com = [0, comDepth, 0];
for i = 1:length(theta)
clf
hold on
theta(i);
percent = i/length(theta) * 100
%disp(percent);
y = cob1DZero(theta(i), width, length1, depth, n);
cobX(i) = y(1);
cobY(i) = y(2);
comX(i) = 0;
cob = [cobX(i)/100, cobY(i)/100, 0];
% plot(cobX(i), cobY(i), 'b*');
% plot(com(1), com(2)*100, 'k*');
r = cob - com;
volumeWater = y(3);
magFWater = (volumeWater/1000)*9.8;
slopeFWater = (-1/tan(theta(i)));
angleFWater = atan(slopeFWater);
fWater = -[magFWater*cos(angleFWater), magFWater*sin(angleFWater), 0];
% plot(fWater(1), fWater(2), 'g*');
moment = cross(r, fWater);
momentZ(i) = moment(3);
%magMoment(i) = sqrt(moment(1).^2 + moment(2).^2 + moment(3).^(2));
z(i) = 0;
end
plot(theta.*180./pi, momentZ);
plot(theta.*180./pi, z)