Dimensions don't agree - how to fix?

1 view (last 30 days)
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

Star Strider
Star Strider on 8 Mar 2015
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 Shifting and Sorting Matrices 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!