| Error: Unexpected MATLAB operator. Why, please?
2 次查看(过去 30 天)
显示 更早的评论
plot(plot::Spherical([1, u, v], u = 0..2*PI, v = 0..PI))
plot(plot::Spherical([1, u, v], u = 0..2*PI, v = 0..PI))
| Error: Unexpected MATLAB operator.
I am using matlab version 7.14.0.739 (R2012a) . Why error is coming. Please help me
>> version ans = 7.14.0.739 (R2012a)
1 个评论
dpb
2017-5-30
Bad syntax all over...no idea where the line came from, but just isn't Matlab-y syntax at all.
There isn't any '::' operator in Matlab, plot syntax is basically
plot(x,y)
where x,y are independent/dependent variables to be plotted, Assignment in a function call isn't how named parameters are used in Matlab and the '..' sequence isn't legal if were besides. The builtin function returning the value for pi is pi in Matlab not PI just for starters...
回答(1 个)
Steven Lord
2017-5-30
Whenever you see :: or .. (without a third period to make an ellipsis) in a command, it's likely a command intended to be used in a MuPAD Notebook not in a MATLAB function or at the MATLAB Command Prompt.
There isn't really a direct equivalent of the plot::Spherical command that will work in MATLAB. Close would be to generate your data in spherical coordinates, use sph2cart to convert those coordinates to Cartesian, then use surf or a similar function to plot the data using Cartesian coordinates.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!