Info
This question is closed. Reopen it to edit or answer.
In line 5,'The dimensions of the matrix must match.' Is displayed. How do I fix it???
2 views (last 30 days)
Show older comments
Hf_fig = figure;
set(Hf_fig, 'NumberTitle', 'off',...
'Name', 'B and M curves');
clf
x = -T.* sin(heel); y = T.*cos(heel) ; k = length(heel);
Bcenter = zeros(2,k); Bcenter(1,:) = [0;KB(1)];
M = zeros(2,k); M(1,:) = [0;KB(1)];
f = max((B/0.8), (B^2/(12*T(1))+T(1)/2));
plot(station(1, :), station(2, :), 'b-')
axis([ -f/2 f/2 -T(1)/2 (f-T(1)/2) ])
axis('square'), axis('off')
hold on
text(-B/1.8, T(1)+0.25, 'W_0')
text( B/1.8, T(1)+0.25, 'L_0')
text(-B/13, KB(1), 'B') , text(0, KM(1)+0.3, 'M')
xl = x0(1) - B/1.5; yl = y0(1); xr = x0(1) + B/(1.8-1/10);
yr = y0(1);
plot([ xl xr ], [ yl yr ])
plot(0, KB(1), 'r*')
plot(0, KM(1), 'ko')
plot([ 0 0 ], [ KB(1) KM(1) ], 'c-.')
pause
for I = 2:k
xl = x0(l) - B*cos(heel(l))/(1.5+l/1.7);
yl = y0(l) - B*sin(heel(l))/(1.5+l/1.7);
xr = x0(l) + B*cos(heel(l))/(1.8-l/10);
yr = y0(l) + B*sin(heel(l))/(1.8-l/10);
plot([ xl xr ], [ yl yr ])
if l ~= 1
string = [ num2str(phi(l)) '^o' ];
text(xl, yl, string)
text(xr, yr, string)
end
Bcenter(:, l) = rotate(heel(l))*[ w(l); KB(l) ];
plot(Bcenter(1, l), Bcenter(2, l), 'r*')
M(:, l) = rotate(heel(l))*[ w(l); KM(l) ];
plot(M(1, l), M(2, l), 'ko')
plot([ Bcenter(1, l), M(1, l) ], [ Bcenter(2, l), M(2, l) ],...
'k--')
pause(1)
end
pause
Bx = 0: Bcenter(1, k)/50: Bcenter(1, k); % interpolation axis
By = spline(Bcenter(1, :), Bcenter(2, :), Bx);
plot(Bx, By, 'm-')
Mx = 0: M(1, k)/50: M(1, k);
My = spline(M(1, :), M(2, :), Mx);
plot(Mx, My, 'y-') , text(-B/1.5, 1.4*KM(1),...
'The M-curve is the evolute of the B-curve')
hold off
P1 = [ 0.000; 0.50 ]; P2 = [ 0.240; 0.50 ];
P3 = [ 0.240; 0.58]; P4 = [ 1.100; 1.00 ]; P5 = [ 1.787; 1.25 ];
P6 = [ 2.460; 1.50 ]; P7 = [ 2.902; 1.75 ]; P8 = [ 3.100; 2.00 ];
P9 = [ 3.176; 2.25 ]; P10 = [ 3.200; 2.50 ]; P11 = [ 3.218; 2.75 ];
P12 = [ 3.230; 3.00 ]; P13 = [ 3.230; 3.36 ]; P14 = [ 2.099; 3.425 ];
P15 = [ 0.000; 3.489 ];
starb = [ P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 P11 P12 P14 P15 ];
port = [ -starb(1, :); starb(2, :) ];
port = fliplr(port);
phi = 0: 15: 90;
heel = pi*phi/180;
B = 6.480;
T = [ 1.729 1.575 1.163 0.600 -0.012 -0.693 -1.354 ];
w = [ 0 1.122 1.979 2.595 2.945 2.874 2.539 ];
KB = [ 1.272 1.121 0.711 0.107 -0.625 -1.393 -2.108 ];
KM = [ 4.596 3.711 2.857 1.830 0.479 -0.869 -1.471 ];
function r = rotate(phi)
r = [ cos(phi) -sin(phi); sin(phi) cos(phi) ];
end
1 Comment
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!