Plotting graph for integration with parameters

1 回表示 (過去 30 日間)
KK
KK 2021 年 4 月 26 日
回答済み: Anilcan Taner 2021 年 4 月 26 日
I would like to draw a graph . I can't get any graph with my code. Interval of Fn is 0.05 and want it to be plotted on x axis.
T = 0.08; B = 0.1; L = 1; S = 0.188;
syms u
for Fn = 0.1 : 0.05 : 0.7
K = @(u) 32./pi.*B.^2.*(T./L).^2./S./Fn.^4.*((sin(cosh(u)./(2.*Fn.^2))./(cosh(u)./(2.*Fn.^2)).^2 - cos(cosh(u)./(2.*Fn.^2))./(cosh(u)./(2.*Fn.^2))).*((1-2./(T./L.*(cosh(u)./Fn).^2).^2)./(T./L.*(cosh(u)./Fn).^2)+2./(T./L.*(cosh(u)./Fn).^2).^2.*exp(-T./L.*(cosh(u)./Fn).^2).^2.*(1+1./(T./L.*(cosh(u)./Fn).^2))).*cosh(u)).^2;
Q = int(K,u,0,10);
end
hold on
for Fn = 0.1 : 0.05 : 0.7
plot(Fn,Q)
end
hold off
It's my first time making a code so there would be lots of errors.
Q converges before inf. So doesn,t need to be integrated to infinity.
K would be like below as make it simpler.
T = 0.08; B = 0.1; L = 1; S = 0.188;
a = @(u) cosh(u)/(2*Fn^2);
b = @(u) T/L*(cosh(u)/Fn)^2;
X=@(u,a) sin(a)/a.^2-cos(a)/a;
Z=@(u,b) 1/b*(1-2/b.^2)+2/b.^2*(1+1/b)*exp(-b);
K=@(u,X,Z,a,b) 32/pi*B.^2/S*(T/L).^2/Fn.^4*(X*Z*cosh(u)).^2

回答 (1 件)

Anilcan Taner
Anilcan Taner 2021 年 4 月 26 日
Sadly I have no idea about your code but I guess you should create empty Q variable with lets say ones code or zeros code. By that I mean that your Q variable might not be saving along the way in the for loop. Q=ones(your_size_in_row,your_size_in_column)
Same follows for Fn too, create Fn in variable form than try to plot(Fn,Q).
Hope it helps. I am newbie like you too.

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by