How would I write a function that uses the function I have to plot A and V versus a for 0.25 <= a <= 4 inches.
1 view (last 30 days)
Show older comments
function [V, A] = calc(a)
if (a > 4)
if (a < 0.25)
V = 1/4 * pi * ((a+(a+2)) * ((a+2)-a) ^ 2);
A = pi ^ 2 * ((a+2) ^ 2 - a ^ 2);
0 Comments
Accepted Answer
Walter Roberson
on 19 Apr 2011
function [V,A] = calc(n)
a = linspace(0.25,4,n);
V = 1/4 .* pi .* ((a+(a+2)) .* ((a+2)-a) .^ 2);
A = pi ^ 2 .* ((a+2) .^ 2 - a .^ 2);
plot(a,V,a,A);
The input, n, is the number of subdivisions to use along 0.25 to 4. Or to be more correct, n is the total number of points to use in the plot, including the two end-points.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!