I was able to find the maximum velocity and acceleration for part b. However, ha
ID: 2997770 • Letter: I
Question
I was able to find the maximum velocity and acceleration for part b. However, having difficulty using the fzero function to solve for part c and d. The question for part c and d is listed below in my code. clear; clc; % (a) In MATLAB, create a matrix consisting of s vs. t, v vs. t, and a vs. % t for 0<=t<=0.01 second. Use 50 subdivions on the t domain. Take r = 9 % cm, w = 100 revolutions per second, and b = 14 cm. Plot s vs. t, v vs. t, % and a vs. t on three separate graphs. % Revolutions Per Second w=100; % [rev/s] % Piston Rod Length b=0.14; % [m] % Time Step dt=.01/50; % [s] % Crackshaft Radius r=0.09; % [m] for k = 1:51 % Time Vector t(k)=(k-1)*dt; arg1=2*pi*w*t(k); term=b^2-r^2*(sin(arg1))^2; o2=2*pi*w; % Displacement s(k)=r*cos(arg1)+sqrt(term); % Velocity v(k)=-o2*r*sin(arg1)-(o2*r^2*sin(arg1)*cos(arg1))/sqrt(term); % Acceleration term1=-o2^2*r*cos(arg1); term2Num=-2*o2^2*r^4*(sin(arg1))^2*(cos(arg1))^2; term2Den=term^1.5; term2=term2Num/term2Den; term3=-o2^2*r^2*(cos(arg1))^2/sqrt(term); term4=o2^2*r^2*(sin(arg1))^2/sqrt(term); a(k)=term1+term2+term3+term4; % Applying all into one matrix Aug=[t;s;v;a]; end % (b) Using MATLAB's max function and the matrix obtained in part (a), % determine the approximate maximum velocity and maximum acceleration in % one revolution, and print out those values.
Vmax=max(v); Amax=max(a);
% (c) Using MATLAB's fzero function, determine the time when the velocity of the piston reaches 1/2 of its maximum velocity.
% (d) Using MATLAB's fzero function, determine the time when the acceleration of the piston reaches 1/2 of its maximum acceleration.
Explanation / Answer
% X = FZERO(FUN,X0) tries to find a zero of the function FUN near X0,
% if X0 is a scalar. It first finds an interval containing X0 where the
% function values of the interval endpoints differ in sign, then searches
%that interval for a zero. FUN is a function handle. FUN accepts real
% scalar input X and returns a real scalar function value F, evaluated
% at X.
% (c).
region =[0 0.01];
f1= @(t) (-o2*r*sin(2*pi*w*t)-(o2*r^2*sin(2*pi*w*t)*cos(2*pi*w*t))/sqrt(b^2-r^2*(sin(2*pi*w*t))^2)-Vmax /2);
x1= fzero( f 1, region);
% (d).
x1= fzero( f , region);
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.