where is the error in my code?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Torsten
2022년 6월 25일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!