Definite integral with complex number (2024)

22 views (last 30 days)

Show older comments

Pilar Jiménez on 17 Jan 2017

  • Link

    Direct link to this question

    https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number

  • Link

    Direct link to this question

    https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number

Commented: Star Strider on 18 Jan 2017

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?

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

Answers (2)

Star Strider on 18 Jan 2017

  • Link

    Direct link to this answer

    https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#answer_250967

  • Link

    Direct link to this answer

    https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#answer_250967

Open in MATLAB Online

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 Comments

Show 4 older commentsHide 4 older comments

Pilar Jiménez on 18 Jan 2017

Direct link to this comment

https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421148

  • Link

    Direct link to this comment

    https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421148

Edited: Pilar Jiménez on 18 Jan 2017

Open in MATLAB Online

Thank you so much, the truth is that I´m little bit confusing because a professor tell me that the result that I must obtain is 0.300000, the way that I choose for try to obtain that result was to take the absolute of the result but I obtained the same result as you, and the absolute for this is 0.0407 that definitely is not the 0.3000 that the professor tell me. The code that I used was

an=int(wn.*(t).*exp(1i.*2.*pi.*t),0,0.3);

area=double(an);

I=abs(area);

Do you know how evaluate this integral with a program to obtain the area under the wave?, I tried to do too but I obtained the same result.

Star Strider on 18 Jan 2017

Direct link to this comment

https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421231

  • Link

    Direct link to this comment

    https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421231

Open in MATLAB Online

My pleasure.

If the absolute value of the integrated function is supposed to be 0.3 and you want to find the upper integration limit, my code changes to:

syms wn t u_lim

wn = sym(1);

f = (wn.*t).*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 =

- 1.2344562607584131074713514095035 - 0.079932307838809295659734063695053i

abs_upper_limit =

1.2370414033338097576212422129676

Does this do what you want?

Pilar Jiménez on 18 Jan 2017

Direct link to this comment

https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421335

  • Link

    Direct link to this comment

    https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421335

I`m not sure but I will share it with my professor to check it, thank you so much for your support. I will tell you if the code is that I need.

Pilar Jiménez on 18 Jan 2017

Direct link to this comment

https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421365

  • Link

    Direct link to this comment

    https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421365

Edited: Pilar Jiménez on 18 Jan 2017

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?

Star Strider on 18 Jan 2017

Direct link to this comment

https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421367

My pleasure.

Please let me know.

Star Strider on 18 Jan 2017

Direct link to this comment

https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421368

  • Link

    Direct link to this comment

    https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421368

Open in MATLAB Online

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.

Sign in to comment.

David Goodmanson on 18 Jan 2017

  • Link

    Direct link to this answer

    https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#answer_250971

  • Link

    Direct link to this answer

    https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#answer_250971

Edited: David Goodmanson on 18 Jan 2017

Open in MATLAB Online

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 Comments

Show 2 older commentsHide 2 older comments

Pilar Jiménez on 18 Jan 2017

Direct link to this comment

https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421150

  • Link

    Direct link to this comment

    https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421150

Edited: Pilar Jiménez on 18 Jan 2017

Open in MATLAB Online

Thank you so much David, the truth is that I must do other details in my integral that does not allow me to handle symbolic variables, I had problems with them so I try to avoid them. And I´m little bit confusing because a professor tell me that the result that I must obtain is 0.300000, the way that I choose for try to obtain that result was to take the absolute of the result but I obtained the same result as you, and the absolute for this is 0.0407 that definitely is not the 0.3000 that the professor tell me. The code that I used was

an=int(wn.*(t).*exp(1i.*2.*pi.*t),0,0.3);

area=double(an);

I=abs(area);

Do you know how evaluate this integral with a program to obtain the area under the wave?, I tried to do too but I obtained the same result. I`ve been trying to do this many days but I obtain the same result in each code that I do.

David Goodmanson on 18 Jan 2017

Direct link to this comment

https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421170

  • Link

    Direct link to this comment

    https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421170

Edited: David Goodmanson on 18 Jan 2017

Hi Diana, I think it's time to talk to your prof because it seems like there must be some kind of mistake. You and two of us on this site have all gotten the same answer, given the integrand and the integration limits that were specified.

Pilar Jiménez on 18 Jan 2017

Direct link to this comment

https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421331

  • Link

    Direct link to this comment

    https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421331

Yes, I will share with him to check it. Thanks for you support.

Pilar Jiménez on 18 Jan 2017

Direct link to this comment

https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421366

  • Link

    Direct link to this comment

    https://webchat.mathworks.com/matlabcentral/answers/320828-definite-integral-with-complex-number#comment_421366

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?

Sign in to comment.

Sign in to answer this question.

See Also

Categories

Mathematics and OptimizationSymbolic Math ToolboxMathematicsLinear Algebra

Find more on Linear Algebra in Help Center and File Exchange

Tags

  • integral
  • numerical answer
  • definite integral
  • sum under the wave
  • funcion complex number
  • intengral without symbolic variable

Community Treasure Hunt

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

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


Definite integral with complex number (14)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asia Pacific

Contact your local office

Definite integral with complex number (2024)

References

Top Articles
Latest Posts
Article information

Author: Jeremiah Abshire

Last Updated:

Views: 5551

Rating: 4.3 / 5 (74 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Jeremiah Abshire

Birthday: 1993-09-14

Address: Apt. 425 92748 Jannie Centers, Port Nikitaville, VT 82110

Phone: +8096210939894

Job: Lead Healthcare Manager

Hobby: Watching movies, Watching movies, Knapping, LARPing, Coffee roasting, Lacemaking, Gaming

Introduction: My name is Jeremiah Abshire, I am a outstanding, kind, clever, hilarious, curious, hilarious, outstanding person who loves writing and wants to share my knowledge and understanding with you.