MATLAB: Defining a variable in matlab

plotvariable

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

Best Answer

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