| Error: Unexpected MATLAB operator. Why, please?

2 visualizaciones (últimos 30 días)
mahipal komandla
mahipal komandla el 30 de Mayo de 2017
Respondida: Steven Lord el 30 de Mayo de 2017
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 comentario
dpb
dpb el 30 de Mayo de 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...

Iniciar sesión para comentar.

Respuestas (1)

Steven Lord
Steven Lord el 30 de Mayo de 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!

Translated by