Dimensions don't agree - how to fix?

Hi, I tried to run the following script but couldn't get it to run because the dimensions don't agree. Any pointers on how to fix this guys? Script below
function PL = ppressure(t)
vol_tid = 0.41 ;
Pm = 760;
R = 1;
w = 2*pi*(0.2);
E = 70;
t=[0:2.5:17.5]
PL = Pm -(R*w)*(2*pi*t)*(0.5*vol_tid)*sin(w*t) - E*((2.5 - (0.5 * vol_tid)) * cos(w*t))
plot(t,PL),
title('y-ppressure')

 Accepted Answer

When in doubt, vectorise !
This works:
PL = Pm -(R*w)*(2*pi*t).*(0.5*vol_tid).*sin(w*t) - E*((2.5 - (0.5 * vol_tid)) * cos(w*t));

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!