Visualise and find the volume of the region in the first quadrant bounded above by the line y = √2, below by the curve y = sec(x)tan(x), and on the left by the y−axis, about the line y = √2

42 次查看(过去 30 天)
Please help as fast today only. Thanks.
  2 个评论
GANGA
GANGA 2023-10-27
clc
clear all
syms x
f = input('Enter any function: ');
fl = input('Enter the interval on whch the function is defined: ');
yr = input("Enter the axis of rotation of y = c (enter only c value)")
il = intput("Enter the integration limits: ");
volume = pi*int((f-yr)^2,il(1),il(2));
disp(['volume is: ', num2str(double(volume))])
fx = inline(vectorize(f))
xvals = linspace(fl(1),fl(2),201);
xvalsr = fliplr(xivals);
xivals = linspace(il(1),il(2),201);
xivalsr = fliplr(xivals);
xlim = [fl(1) fl(2)+0.5];
ylim = fx(xlim);
figure('postiton',[100 200 500 420])
subplot(2,1,1)
hold on;
plot(xvals,fx(xvals),'-b','linewidth',2);
fill([xvals xvalsr],[fx(xvals) ones(sixe(xvals))*yr],[0.8 0.8 0.8],'facealpha',0.8)
plot([fl(1) fl(2)],[yr yr] , '-r' , 'linewidth',2);
legend("Function plot" , "Filled region" , "Axis of Rotation" , "Location" , "Best");
title("Function y = f(x) and region");
set(gca,'xlim',xlim)
xlabel('x-axis');
ylabel('Y-axis');
[x,y,z] = cylinder(fx(xivals) - yr , 100);
figure('Position',[700 200 560 420])
z = il(1) + z.*(il(2)-il(1));
surf(z,(y + yr),x,'Edgecolor','name','Facecolor','flat','FaceAlpha',0.6);
hold on;
plot([il(1) il(2)] , [yr yr], '-r' , 'linewidth' , 2);
xlabel('x-axis');
ylabel('y-axis');
zlabel('z-axis');
view(22,11);

请先登录,再进行评论。

回答(0 个)

类别

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