What does this error message mean?

조회 수: 1 (최근 30일)
laura
laura 2016년 4월 19일
답변: Adithya Addanki 2016년 4월 21일
I am trying to write a function that graphs 'y' as a function of 'h'. I'm trying to learn Matlab and I think I may have missed something on this code since it won't work. Any advice? I need the interval to be 40 to 400 for h.

답변 (1개)

Adithya Addanki
Adithya Addanki 2016년 4월 21일
Hi Laura,
I understand that you are new to MATLAB, please refer to the links below to help you get started on the syntaxes used in MATLAB. I see that you are trying to relate MATLAB to C/C++, please understand that the syntax is different.
Additionally, I took the liberty of changing a few syntaxes and semantics in the code to get it going. I am not sure about what is expected of the output, but it works.
function plotYonH
h=50:400;
b=h/2;
s=((b'*(h.^3))./6); % used to be b*h which is mathematically not possible unless you mean element wise multiplication as below
%s=((b.*(h.^3))/6);
y=(s/384000); % I am unsure what you meant by 384000/s as s is a matrix so, changed it to s/384000
plot(h,y);
end
I hope this helps.
Thanks,
Adithya

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by