Error on using rotate - to many input arguments

Hi,
I wanted to get the area of evolution of a function. so i tried a code that someone used on youtube. I did the same as he did , but iget an error.
May you can help.
clear
x = linspace(0, 1, 21);
% y = 1.38188 - 0.58417*x + 0.09832*x.^2 - 0.00787*x.^3 + 0.000258*x.^4
y = 2*x.^2;
plot(x,y); daspect([1,1,1])
z = y; y = 0*y;
X = x; Y = y; Z = z;
[x,y,z] = rotate(x,y,z,[0,0,1],pi/20);
X = [X,x]; Y = [Y,y]; Z = [Z,z];
S = surf(X, Y, Z);
axis([-1,1,-1,1,0,2]); daspect([1,1,1]);
error is:
Error using rotate
Too many input arguments.
Error in areofrevolution (line 10)
[x,y,z] = rotate(x,y,z,[0,0,1],pi/20);

Respuestas (1)

MATLAB offers several different rotate() functions -- but all of them are effectively class methods -- functions that only operate if the first parameter is a particular data type. None of the MATLAB rotate() methods support numeric values as the first parameter to rotate -- no x y z centre of rotation.
The YouTube video must have been using its own rotate() function, which you would have to locate the code for.
(My above statements are not completely true. The function that is rotate(H, [THETA PHI],ALPHA) or rotate(H,[X Y Z],ALPHA) will accept a numeric scalar in the H position, provided that the value given is the double precision representation of an axes child. For example,
format long g
s = surf(peaks(20));
sd = double(s)
sd =
10.0054931640625
rotate(sd, [1 0 0], 25)
This is a nearly-obsolete syntax.)

4 comentarios

Tim Sieber
Tim Sieber el 12 de Mayo de 2023
ok thank you, so it is because i want to rotate a point. so how can i solve this?
I have a polynom of 4th grade and need to get the surface area of evolution.
May you have an advice. I tried several answers here on matlabanswers but didnt get a working solution
Tim Sieber
Tim Sieber el 12 de Mayo de 2023
Editada: Tim Sieber el 12 de Mayo de 2023
edit:
the first one would be nice, but always gives me errors. even with the example
Walter Roberson
Walter Roberson el 12 de Mayo de 2023
https://www.mathworks.com/matlabcentral/fileexchange/67585-solids-of-revolution-gui?s_tid=ta_fx_results worked for me. (Note: 3D plot figure was behind 2D plot figure, move the 2D plot to see it)

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Productos

Versión

R2021b

Preguntada:

el 12 de Mayo de 2023

Comentada:

el 12 de Mayo de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by