Matlab doesn;t recognise a variable when I run the program
古いコメントを表示
Hi, I'm trying to write a loop where my data enters into either 1 of 2 equations depending on the condition but when I run it, it says that variable 'y' is not recognised and I don;t know why
Here is what I did and I can't figure out what I did wrong
L=25;
E=200^9;
I=350^(-6);
w=6^3;
x=linspace(0,28,51);
for i=0:51
if x>=0 & x<=L/2
y=-((w.*x)./(348.*E.*I)).*((16.*x.^3)-(24.*L.*x.^2)+(9.*L^3));
elseif x>=L/2 & x<=L
y=-((w.*x)./(384.*E.*I)).*((8.*x.^3)-(24.*L.*x.^2)+(17.*L^2.*x)-(L^3));
end
end
plot(x,y)

Here is a screenshot of my question of what I'm trying to do here
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!