where is the error in my code?
2 views (last 30 days)
Show older comments
Hi every one,
I would like to plot the relationship between the integral (fun) and the variable (w) from 1 to 4 and I used the following code. However, the plot seems to be wrong! where is the error?
syms w x
V1 = @(w) -acosh(10*(w./(21))^(1/2))/10000000000;
V2 = @(w) acosh(10*(w./(21))^(1/2))/10000000000;
fun = @(x,w)0.0018./((w./((cosh(10^10.*x./1)).^2)-(0.21)).^0.5);
q = @(w) integral(@(x)fun(x,w),V1(w),V2(w));
w = 1:4;
fplot(w,q)
0 Comments
Answers (1)
Torsten
on 25 Jun 2022
V1 = @(r,w) -acosh(10*(w/(1600*r + 21))^(1/2))/20000000000;
V2 = @(r,w) acosh(10*(w/(1600*r + 21))^(1/2))/20000000000;
% Define function to be integrated
fun = @(x,r,w)2.3*r.*0.0018./((w./((cosh(10^10.*x./0.5)).^2)-(r.*16+0.21)).^(1/2));
r = 0.001:0.001:0.07;
w = 0:0.1:5;
[R,W] = meshgrid(r,w);
F = @(r,w)integral(@(x)fun(x,r,w),V1(r,w),V2(r,w));
result = arrayfun(F,R,W)
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!