Dimensions don't agree - how to fix?

1 次查看(过去 30 天)
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')

采纳的回答

Star Strider
Star Strider 2015-3-8
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));

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by