there is also a mistake here i can't recognize it , please help
Show older comments
%calculating velocity
V3 = .1; % velocity of the piston in m/sec
%global c
th2 = pi/6; % initial value for th2
th3 = pi/6; %initial value for th3
% c= 28.8:0.2:52.6;
C = 28.8:0.2:52.6;
for ii = 1:length(C)
% c = C(ii);
th3(ii) = acos((-1425 - (C(ii)).^2)./(110.*C(ii)));
th2(ii) = acos((C(ii).^2 - 4625)./(-4400));
M = [-40*sin(th2(ii)) C(ii)*sin(th3(ii)); 40*cos(th2(ii)) -C(ii)*cos(th3(ii))];
N = [V3*cos(th3(ii)); V3*sin(th3(ii))];
W(:,ii) = M\N;
end
W2 = W(1,:);
W3 = W(2,:);
figure;
subplot(2,1,1); plot(th2,W2,'r','linewidth',2);grid
xlabel('{\theta_{2}} [rad]');
ylabel('{\omega_{2}} [rad/sec]');
subplot(2,1,2); plot(th2,W3,'r','linewidth',2);grid
xlabel('{\theta_{2}} [rad]');
ylabel('{\omega_{3}} [rad/sec]');
%Acceleration calculation
V3 = .1; % acceleration of the piston in m/sec
%V3dot = V3 we substituite with V3 not V3dot
%global c
th2 = pi/6; % initial value for th2
th3 = pi/6; %initial value for th3
% c= 28.8:0.2:52.6;
C = 28.8:0.2:52.6;
for ii = 1:length(C)
% c = C(ii);
th3(ii) = acos((-1425 - (C(ii)).^2)./(110.*C(ii)));
th2(ii) = acos((C(ii).^2 - 4625)./(-4400));
M = [40*sin(th2(ii)) -C(ii)*sin(th3(ii)); 40*cos(th2(ii)) -C(ii)*cos(th3(ii))];
N = [-V3*cos(th3(ii))-40*W2(ii)^2*cos(th2(ii))+C(ii)*W3(ii)^2*cos(th3(ii))+V3*W3(ii)*sin(th3(ii)); V3*sin(th3(ii))+V3*W3(ii)*cos(th3(ii))-C(ii)*W3(ii)^2*sin(th3)+40*W2(ii)^2*sin(th2(ii))];
A(:,ii) = M\N;
end
A2 = A(1,:);
A3 = A(2,:);
figure;
subplot(2,1,1); plot(th2,A2,'r','linewidth',2);grid
xlabel('{\theta_{2}} [rad]');
ylabel('{\alpha_{2}} [rad/sec^2]');
subplot(2,1,2); plot(th2,A3,'r','linewidth',2);grid
xlabel('{\theta_{2}} [rad]');
ylabel('{\alpha_{3}} [rad/sec]');
1 Comment
seif eldin Ahmed
on 10 Jan 2021
Answers (1)
Alan Stevens
on 10 Jan 2021
You need
N = [-V3*cos(th3(ii))-40*W2(ii).^2*cos(th2(ii))+C(ii)*W3(ii).^2*cos(th3(ii))+V3*W3(ii)*sin(th3(ii)); V3*sin(th3(ii))+V3*W3(ii)*cos(th3(ii))-C(ii)*W3(ii).^2*sin(th3(ii))+40*W2(ii).^2*sin(th2(ii))];
If you compare this with your expression you will see that you have th3 instead of th3(ii) in a couple of places.
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!