フィルターのクリア

Definite integral with complex number

55 ビュー (過去 30 日間)
Pilar Jiménez
Pilar Jiménez 2017 年 1 月 17 日
コメント済み: Star Strider 2017 年 1 月 18 日
I need to solve an integral of the function f=(wn.*t).*exp(1i.*2.*pi.*t) where wn=1 and have complex numbers, it is a definite integral of 0 to 0.3 and I have to obtain a numeric answer. I tried to do with the comands int and integral but doesn`t help me because this comands uses symbolics variables and I need numeric answers, and I tried to obtain the sum under the wave but I couldn`t solve it. Can someone help me?

回答 (2 件)

Star Strider
Star Strider 2017 年 1 月 18 日
Use the vpa function:
syms wn t
wn = sym(1);
f = (wn.*t).*exp(1i.*2.*pi.*t);
f_int = int(f, t, 0, 0.3)
f_int_num = vpa(f_int)
f_int =
- 1/(4*pi^2) - (((pi*3i)/5 - 1)*(1/4 + (2^(1/2)*(5^(1/2) + 5)^(1/2)*1i)/4 - 5^(1/2)/4))/(4*pi^2)
f_int_num =
0.012251815898938149373515863015179 + 0.038845017631697804582142824751429i
  6 件のコメント
Star Strider
Star Strider 2017 年 1 月 18 日
My pleasure.
Please let me know.
Star Strider
Star Strider 2017 年 1 月 18 日
To define ‘wn(t)’ as uniformly equal to 1 definitely changes the result:
syms wn t u_lim wn(t)
wn(t) = sym(1);
f = wn*exp(1i*2.*pi*t);
upper_limit = vpasolve(abs(int(f, t, 0, u_lim)) == 0.3, u_lim)
abs_upper_limit = abs(upper_limit)
upper_limit =
61.162453359143770665259861917249 - 0.1257699093208763500021861131513i
abs_upper_limit =
61.162582670939654308556507428042
Is the rest correct? Are you solving for the upper limit of integration that will make the integral equal to 0.3? If so, this works.

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


David Goodmanson
David Goodmanson 2017 年 1 月 18 日
編集済み: David Goodmanson 2017 年 1 月 18 日
Hello Diana, symbolic variables are a great thing, but if you are looking for a numerical result and are happy with 15 or so sigfigs, it isn't like they have to be invoked. You can just do
ff = @(t,wn) (wn.*t).*exp(1i.*2.*pi.*t) % or you could define this in an mfile
integral(@(t) ff(t,1),0,.3) % pass in wn =1
format long
ans = 0.012251815898938 + 0.038845017631698i
Now that symbolic variables are much better integrated into Matlab, sometimes I wonder if they are getting overused.
  4 件のコメント
Pilar Jiménez
Pilar Jiménez 2017 年 1 月 18 日
Yes, I will share with him to check it. Thanks for you support.
Pilar Jiménez
Pilar Jiménez 2017 年 1 月 18 日
I checked with my professor and I have a mistake, the function is incorrect. Wn is not multiplied by t, it is in function of t. I mean, the correct expression is wn(t) not wn.*t, do you know how I can register that in the code?

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by