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 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Walter Roberson
2011 年 4 月 19 日
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 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!