I have a problem with the final part of this code, I can't plot the last graphic. Thank you.
n=2000; % [rpm]
phi=0:2*pi/1000:2*pi; % [rad]
r=0.25; % [m]
l=0.57; % [m]lam=r/l; % lambda
sb=r*(1+lam/4-cos(phi)-(lam*cos(2*phi))/4); % spostamento del pistone
syms x(ang);x(ang)=r*(1+lam/4-cos(ang)-(lam*cos(2*ang))/4);sb_sym=x(phi);figure(1)plot(phi,sb,'*',phi,sb_sym)title('Grafico Spostamenti');legend('spostamento [m]','spostamento:formula simbolica [m]');grid on;figure(2)fplot(x,[0,2*pi])title('Grafico Simbolico Spostamenti [m]');syms x_dot(ang)x_dot(ang)=diff(x(ang))Om=n*((2*pi)/60); % omega [rad/s]
vb_sym=Om*x_dot(phi);vb_num=Om*(diff(sb)./diff(phi));vb=Om*r*(sin(phi)+(lam*sin(2*phi))/2);figure(3)plot(phi,vb,'*',phi(1:end-1),vb_num,phi,vb_sym)title ('Grafico Velocità')legend('velocita [m/s]','velocita:formula simbolica [m/s]');grid on;ab=(Om^2)*r*(cos(phi)+lam*cos(2*phi));ab_num=(Om^2)*(diff(vb)./diff(phi));syms vb(ang);vb(ang)=Om*r*(sin(ang)+(lam*sin(2*ang))/2);vb_dot(ang)=diff(vb(ang));ab_sym=vb_dot(ang);figure(4)plot(phi,ab,'*',phi(1:end-1),ab(1:end-1),ab_num,phi,ab_sym) *ERROR using plot. Vectors must be same lenghttitle('Grafico Accelerazione')legend('accelerazione[m/s^2]','accelerazione:formula simbolica [m/s^2]');grid on;
Best Answer