A simple question about undefined function error
2 次查看(过去 30 天)
显示 更早的评论
Hello,
Before i ask my question i want to mention that i am beginner level in matlab.
I wrote in matlab a simple program which is given below:
function Problem6I(f,g,x)
plot(x,f,'red',x,g,'cyan');
end
I defined x=linspace(0,40000,40), g=sin(x*pi)+(x.^2)/20 and f=(x.^2)/20 , but I still get this error message:
??? Undefined function or method 'Problem6I' for input arguments of type 'double'.
How can I solve it?
0 个评论
采纳的回答
Thomas
2012-10-5
编辑:Thomas
2012-10-5
You are defining it as a function Here is more about declaring functions http://www.mathworks.com/help/matlab/ref/function.html
You could save it as problem6l and then run it
If you use it as a script it should work
x=linspace(0,40000,40); g=sin(x*pi)+(x.^2)/20 ; f=(x.^2)/20;
plot(x,f,'red',x,g,'cyan')
2 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!