MATLAB: Differentiation of vol for theta

diff()

Can you show me what is the answer?What is the answer?
dvol/dtheta?
clear();
r = 8; % compression ratio
s = 100; % stroke (mm)
b=s; % bore=stoke
len= 150; % connecting rod length (mm)
Vd= b^2*s*pi/4; % displacement volume
Vc=Vd/(r-1); % clearence volume
a=s/2; % radius of crank shaft
theta=-180:1:180; % crankangle theta vector
y =len+a-((len^2-a^2*sind(theta).^2).^(1/2) +a*cosd(theta)); % .^2).^
vol= Vc+y*b^2*pi/4; % exact volume

Best Answer

Use gradient to differentiate vol with respect to theta numerically
dvol_dtheta = gradient(vol, theta);