How can I Plot a primitive function?

8 ビュー (過去 30 日間)
Nicolas Kennis
Nicolas Kennis 2016 年 10 月 16 日
コメント済み: Nicolas Kennis 2016 年 12 月 19 日
I'd like to use ezplot to draw a function. This is my code:
ray=0.11;
m=3.5;
C=2*10^(-12);
DS=140;
CONST=1/((DS^m)*C*pi^(m/2));
syms x
F= @(x) CONST*((x.^(-m/2))./((1.6906*(x/ray).^5-4.6813*(x/ray).^4+5.4253*(x/ray).^3-2.8213*(x/ray).^2+0.8716*(x/ray)+0.4251).^m));
syms x
z=int(F,x,0,0.04);
syms x
ezplot(z,[0,0.04])
I always find an error while I want to plot this function... Why? This is the error :
Error using inlineeval (line 14)
Error in inline expression ==> int(2000./(x.^(7./4).*((2179.*x)./275 - (28213.*x.^2)./121 + (5425300.*x.^3)./1331 - (468130000.*x.^4)./14641 +
(16906000000.*x.^5)./161051 + 4251./10000).^(7./2)), x, 0, 1./25)
Undefined function 'int' for input arguments of type 'double'.
Error in inline/feval (line 33)
INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);
Error in ezplotfeval (line 51)
z = feval(f,x(1));
Error in ezplot>ezplot1 (line 468)
[y, f, loopflag] = ezplotfeval(f, x);
Error in ezplot (line 144)
[hp, cax] = ezplot1(cax, f{1}, vars, labels, args{:});
Error in sym/ezplot (line 76)
h = ezplot(fhandle(f),varargin{:});

採用された回答

Walter Roberson
Walter Roberson 2016 年 10 月 19 日
xvals = linspace(0, 0.04, 1000);
y = F(xvals);
z = cumtrapz(y);
plot(xvals, z);
  12 件のコメント
Nicolas Kennis
Nicolas Kennis 2016 年 12 月 19 日
編集済み: Nicolas Kennis 2016 年 12 月 19 日
Hello, I do evolved in my function and I've a new code. I've an error but I don't know why? Can you help me? My goal is tho find this integral! I have this error : Error using * , Inner matrix dimensions must agree.
ray = 0.11;
m = 3.5;
C = 2*10^(-12);
DS = 140;
CONST = 1/(C*pi^(m/2));
F = @(x) CONST*((x.^(-m/2))./(((452092178*x.^3-10493093*x.^2+78093.85*x-42.08).^m).*((1.6906*(x/ray).^5-4.6813*(x/ray).^4+5.4253*(x/ray).^3-2.8213*(x/ray).^2+0.8716*(x/ray)+0.4251).^m)));
W=integral(F,0.002,0.01);
disp(['intégrale au point A = : ' num2str(W)]);
Nicolas Kennis
Nicolas Kennis 2016 年 12 月 19 日
OK I found the problem... ;-)

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

その他の回答 (1 件)

Mischa Kim
Mischa Kim 2016 年 10 月 19 日
Nicolas, I would assume that there is no closed-form, symbolic solution for your integral. So instead use numeric integration and the integral function
ray = 0.11;
m = 3.5;
C = 2*10^(-12);
DS = 140;
CONST = 1/((DS^m)*C*pi^(m/2));
F = @(x) CONST*((x.^(-m/2))./((1.6906*(x/ray).^5-4.6813*(x/ray).^4+5.4253*(x/ray).^3- ...
2.8213*(x/ray).^2+0.8716*(x/ray)+0.4251).^m));
z = integral(F,0.01,0.04)
Also, because of the first term in F and the lower limit of x the integral will be infinite. I changed it to 0.01 for a finite result.
  1 件のコメント
Nicolas Kennis
Nicolas Kennis 2016 年 10 月 19 日
編集済み: Nicolas Kennis 2016 年 10 月 19 日
Kim, Thanks for your answer! I really appreciate.
So, it means that there is no solution to plot the primitive of F (from 0.0007 to 0.05 for example)?
Thanks in advance

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

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by