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);

回答(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 个评论

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
edit:
the first one would be nice, but always gives me errors. even with the example

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 2-D and 3-D Plots 的更多信息

产品

版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by