Clear Filters
Clear Filters

| Error: Unexpected MATLAB operator. Why, please?

2 views (last 30 days)
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 Comment
dpb
dpb on 30 May 2017
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...

Sign in to comment.

Answers (1)

Steven Lord
Steven Lord on 30 May 2017
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.

Community Treasure Hunt

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

Start Hunting!