Info
この質問は閉じられています。 編集または回答するには再度開いてください。
help with numerical integration
1 回表示 (過去 30 日間)
古いコメントを表示
I want to numerically integrate a function where a parameter is varied. This is what my code looks like:
y=0:0.0001:30.5;
r=30.5:0.0001:sqrt((y).^2+(25.4)^2);
Sa=3.1381e5;
f=(Sa/2)*(1./(r).*exp(-0.1577534.*r));
F=trapz(r,f)
What I'm trying to tell matlab is to find F for each of the y-values listed. I want matlab to list the array of which y-values were used and the corresponding F for that y-value.
As it is when I enter my code my F is 0.
0 件のコメント
回答 (1 件)
Amit
2014 年 2 月 4 日
First thing: what are you trying to do with y and r? Your r will be empty as the last value in defining r is a vector.
Can you write down what is the correlation in r and y?
2 件のコメント
Amit
2014 年 2 月 4 日
y=0:0.0001:30.5;
r = sqrt((y).^2+(25.4)^2);
Sa=3.1381e5;
f=(Sa/2)*(1./(r).*exp(-0.1577534.*r));
F=trapz(r,f)
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!