How to? - Complex numbers

조회 수: 3 (최근 30일)
STP
STP 2019년 2월 11일
편집: Torsten 2019년 2월 12일
dVdotdt= @(-(Whalf-1i.*w).*V + alfa.*Uin);
(Whalf-1i.*w) part is complex.
When I put the above in my equation I get 'Warning: Imaginary parts of complex X and/or Y arguments ignored'
I am not sure if my syntax is correct to be honest as my answer should be exponential but it is a straight line; also does ode handle complex well- maybe thats the reason my curve is flawed.
  댓글 수: 1
Adam
Adam 2019년 2월 11일
편집: Adam 2019년 2월 11일
You defined a function of two inputs, t and y yet you don'y use either of them in the function so it will just be a constant, defined by the variables you do give which, I assume, are in the workspace at the time you create this function handle. I have no idea where t and y are supposed to fit into your equation though.

댓글을 달려면 로그인하십시오.

채택된 답변

James Tursa
James Tursa 2019년 2월 11일
E.g., for an anonymous function you need to give the input argument list first. E.g., for a generic derivative function that takes t and y as inputs, the syntax would be this:
dydt = @(t,y) some_expression_involving_t_and_y_goes_here;
  댓글 수: 11
STP
STP 2019년 2월 12일
Its the same equation ; only diff being in one i am taking the equation and applying ode solver ; and in the other I have back drafted from solution to find df and then applied ode solver.
Torsten
Torsten 2019년 2월 12일
편집: Torsten 2019년 2월 12일
No.
The first equation has solution
y(t) = 5/3*(1-exp(-t/2)),
the second equation has solution
y(t)=(0.045/0.0337+0.08/0.0337*i)*(1-exp(-0.09*t)*(cos(0.16*t)+i*sin(0.16*t)))
(both only for the t1-range).
Doesn't look the same to me.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by