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

조회 수: 1 (최근 30일)
Anjoud Alkathairi
Anjoud Alkathairi 2022년 11월 14일
답변: Carlos Guerrero García 2022년 11월 22일
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
Carlos Guerrero García 2022년 11월 22일
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에서 Smoothing and Denoising에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by