defining a variable in matlab

V = ((pi*h^2)/3)*((3*r)-h)
plot(h,V)
??? Undefined function or variable 'h'.
Error in ==> p5_22 at 6 V = ((pi*h^2)/3)*((3*r)-h)
I'm sure this is very simple but i forgot how to tell matlab that 'h' is a variable

 采纳的回答

CVR
CVR 2013-9-10

0 个投票

hi there, you can use this one
h = 1:1:10 (create variable h from 1 to 10)

2 个评论

ok, so since h is now a vector i need to add dots in my equation for it to work...where do i insert them?
i got it thank you

请先登录,再进行评论。

更多回答(1 个)

类别

在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by