function y = fresnelS(f,x,n)
Where the function is defined as follows...
What would you add to the code so that you could plot f?
But instead of getting a list of values I want it to produce a graph.

1 件のコメント

Stephen23
Stephen23 2019 年 3 月 8 日
Original function:
function y = fresnelS(f,x,n)
if mod(n,2) == 1
error('The number of strips must be even!');
end
h = x./n;
y = f(x);
for k = 1:2:n
y = y + 4*f(k*h);
end
for k=2:2:n-1
y = y + 2*f(k*h);
end
y = y.*h/3;
end

サインインしてコメントする。

 採用された回答

Stephen23
Stephen23 2019 年 3 月 8 日
編集済み: Stephen23 2019 年 3 月 8 日

0 投票

>> X = linspace(-8,8,500);
>> Y = fresnelS(@(x) sin(x.^2), X, 50);
>> plot(X,Y)
fresnelS.png

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by