how can I find the surface area and the volume through this code?

3 次查看(过去 30 天)
v =[2;0;1;9;0;1;3;0;1];
m = max(v);
n = mean(v);
syms x;
f= @(x)(3+sin(m*x)+cos(n*x));
ezplot(f,[-pi,pi]);
dfx(x)= diff(f(x)); dfx(x)
A=2*pi*int(f*sqrt(1+dfx^2),-2*pi,2*pi);
An = double(A);
V=pi*int((3+sin(n*x))^2,-2*pi,2*pi);
Vn=double(V);

回答(2 个)

Carlos Guerrero García
The surface which area (and volume) is found, can be visualized using the following code:
v =[2;0;1;9;0;1;3;0;1]; % Line in the question
m = max(v); % Line in the question
n = mean(v); % Line in the question
[x,t]=meshgrid(-2*pi:pi/72:2*pi,0:pi/72:2*pi); % Adding the 't' variable for the rotation
y=3+sin(m*x)+cos(n*x); % The function (in the question) to be rotated
surf(x,y.*cos(t),y.*sin(t)) % The surface generated in the rotation

Torsten
Torsten 2022-11-14
v =[2;0;1;9;0;1;3;0;1];
m = max(v);
n = mean(v);
f = @(x)(3+sin(m*x)+cos(n*x));
x = -2*pi:0.01:2*pi;
plot(x,f(x))
df = @(x)m*cos(m*x)-n*sin(n*x);
A = 2*pi*integral(@(x)f(x).*sqrt(1+df(x).^2),-2*pi,2*pi)
A = 1.3816e+03
V = pi*integral(@(x)f(x).^2,-2*pi,2*pi)
V = 381.1362

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by