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 Center および File ExchangeSmoothing and Denoising についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by