Error on using rotate - to many input arguments
Mostra commenti meno recenti
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);
Risposte (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 Commenti
Tim Sieber
il 12 Mag 2023
Tim Sieber
il 12 Mag 2023
Modificato: Tim Sieber
il 12 Mag 2023
Walter Roberson
il 12 Mag 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)
Categorie
Scopri di più su 2-D and 3-D Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
