how can I find the surface area and the volume through this code?
조회 수: 1 (최근 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);
댓글 수: 0
답변 (2개)
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
댓글 수: 0
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)
V = pi*integral(@(x)f(x).^2,-2*pi,2*pi)
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!