Question

A forus is shaped like a doughnut. If its inner radius isa and its outer radius is b, its volume and surface area are given b Matlab
0 0
Add a comment Improve this question Transcribed image text
Answer #1

% Matlab file : P4_fn_calc.m

function [V,A] = P4_fn_calc(a,b)
% Matlab function P4_fn_calc to calculate the volume and surface area
% of a torus gicen its inner radius, a and outer radius,b
  
V = (((pi.^2)./4).*((a+b).*((b-a).^2)));
A = (pi.^2).*((b.^2) - (a.^2));
end

%end of Matlab function

% Matlab file P4.m
% Matlab main script to calculate the values for Volume and Surface area
% for the values of a < b, a>b and a = b using values of a between 1 and 10.
% a < b
a = 2;
b = 4;

[V,A] = torus(a,b);
fprintf('a = %f b = %f V = %f A = %f\n',a,b,V,A);

% a > b
a = 4;
b = 2;

[V,A] = torus(a,b);
fprintf('a = %f b = %f V = %f A = %f\n',a,b,V,A);

% a = b
a = 2;
b = 2;

[V,A] = torus(a,b);
fprintf('a = %f b = %f V = %f A = %f\n',a,b,V,A);
% generate a plot of Volume and Surface Area vs inner radius
% generate 100 points between 0.25 and 4 for the inner radius
a = linspace(0.25,4,100);
b = a+2; % outer radius is 2 in greater than inner radius
% calculate volume and surface arae
[V,A] = torus(a,b);
% plot the graph
plot(a,V,'r-');
hold on;
plot(a,A,'b-');
hold off;
title('Volume and Surface Area of a Torus');
xlabel('Inner radius');
ylabel('Volume and surface Area');
legend('Volume','Surface Area');
%end of script

Output:

a = 2.000000 b = 4.000000 V = 59.217626 A = 118.435253 a = 4.000000 b = 2.000000 V = 59.217626 A = -118.435253 a = 2.000000 b

Add a comment
Know the answer?
Add Answer to:
Matlab A forus is shaped like a doughnut. If its inner radius isa and its outer...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • A small conducting spherical shell with inner radius a and outer radius b is concentric with a larger conducting spherical shell with inner radius c and outer radius d.

     A small conducting spherical shell with inner radius a and outer radius b is concentric with a larger conducting spherical shell with inner radius c and outer radius d. The inner shell has total charge +2q, and the outer shell has charge +4q.  (a) Calculate the magnitude of the electric field in terms of q and the distance r from the common center of the two shells for r < a, b < r < c, and r > d. Note...

  • A conducting spherical shell with inner radius a and outer radius b has a positive point...

    A conducting spherical shell with inner radius a and outer radius b has a positive point charge Q located at its center. The total charge on the shell is -3Q, and it is insulated from its surroundings (Fig. P22.44) (a) Derive expressions for the electric-field magnitude E in terms of the distance from the center for the regions r < a, a < r < b, and r > b. What is the surface charge density (b) on the inner...

  • For the circuit shown below, find HEVA 1 c = OH() - acolo OH() = City...

    For the circuit shown below, find HEVA 1 c = OH() - acolo OH() = City OH OH) = HCL 1) ENGR2304 Final 1.16 points, The US EPA has tested the average fuel efficiency of 24 late model cars. The results obtained are shown below Sample Mileare. Impal Sample Mileagem 25.5 25.4 23.9 24.4 19 22.0 21.7 23.5 27.1 23.0 23.9 23.6 19.2 22.7 26.0 21.3 21 20.7 22 22.8 Enter the data into an Excel spreadsheet and then analyze...

  • A non-conducting thick spherical shell with inner radius a = 5 cm and outer radius b...

    A non-conducting thick spherical shell with inner radius a = 5 cm and outer radius b = 10 cm has a uniformly distributed volume charge density of p = 1.3 nC/m2. a) What is the total charge on the shell? Hint: think of the shell as a solid sphere with a volume in the center that's missing. b) Calculate the maximum electric field strength. c) Calculate the electric field at r = 2 cm. d) Calculate a symbolic equation for...

  • A neutral hollow spherical conducting shell of inner radius 1.00 cm and outer radius 3.00 cm has a +2.00-μC point charge placed at its center.

    Part A A neutral hollow spherical conducting shell of inner radius 1.00 cm and outer radius 3.00 cm has a +2.00-μC point charge placed at its center. (a) Find the surface charge density on the inner surface of the shell. Part B (b) Find the surface charge density on the outer surface of the shell.

  • A hollow sphere of inner radius b and outer radius a is subject to normal pressures on its inner and outer surfaces...

    A hollow sphere of inner radius b and outer radius a is subject to normal pressures on its inner and outer surfaces. The sphere is made up of an isotropic material, the displacements and stress fields are spherically symmetric. The only non-vanishing displacement component is the radial displacement ur, and is a function of r only. Based on this we can assume the following strains. lu lur dr The only non-vanishing stress components are the radial stress σ, and the...

  • A hollow sphere of inner radius b and outer radius a is subject to normal pressures on its inner and outer surfaces...

    A hollow sphere of inner radius b and outer radius a is subject to normal pressures on its inner and outer surfaces. The sphere is made up of an isotropic material, the displacements and stress fields are spherically symmetric. The only non-vanishing displacement component is the radial displacement ur, and is a function of r only. Based on this we can assume the following strains. lu lur dr The only non-vanishing stress components are the radial stress σ, and the...

  • A conducting spherical shell of inner radius R1 and outer radius R2 has a point charge +q fixed at its center

    A conducting spherical shell of inner radius R1 and outer radius R2 has a point charge +q fixed at its center. The spherical shell has a net charge of +aq.Part (a) Enter an expression for the surface charge density on the inner surface of the spherical shell using the variables provided. Part (b) Enter an expression for the surface charge density on the outer surface of the spherical shell using the variables provided. Part (c) The electric field at the surface points...

  • A long, hollow cylinder with inner radius R1 and outer radius R2 carries current along its...

    A long, hollow cylinder with inner radius R1 and outer radius R2 carries current along its length. The current is uniformly distributed over the cross-sectional area of the cylinder and has current density J. 1. Find the magnetic-field magnitude B as a function of the distance r from the conductor axis for points inside the hollow interior (r<R1). Express your answer in terms of the variables R1, R2, J, and r. 2. Find the magnetic-field magnitude B as a function...

  • Vazip Paragraf Saler a db 3. A conducting spherical shell with inner radius a and outer...

    Vazip Paragraf Saler a db 3. A conducting spherical shell with inner radius a and outer radius b has a positive point charge Q located at its center. The total charge on the shell is - 3Q, and it is insulated from its surroundings. (a) Derive expressions for the electric-field magnitude E in terms of the distance r from the center for r <a, a <r<b, and r > b.(15 pts) (b) Sketch the electric field lines.(5 pts) (c) Plot...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT