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)
rotate(sd, [1 0 0], 25)
This is a nearly-obsolete syntax.)
댓글 수: 4
Tim Sieber
2023년 5월 12일
Tim Sieber
2023년 5월 12일
편집: Tim Sieber
2023년 5월 12일
Walter Roberson
2023년 5월 12일
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)
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
