Can someone tell me where is the problem? Matlab doesnt want to show me the real and the imag part of equation
Show older comments
>> syms A B d l >> real(0.98196*A*((-2+5i)^(d+l))+(6.0799*(-2+5i)^(1+l))+(40*(-2+5i)^l)+0.98196*B)
ans =
40*real((- 2 + 5*i)^l) + (60799*real((- 2 + 5*i)^(l + 1)))/10000 + (24549*real((- 2 + 5*i)^(d + l)*A))/25000 + (24549*real(B))/25000
>> imag((0.98196*A*((-2+5i)^(d+l))+(6.0799*(-2+5i)^(1+l))+(40*(-2+5i)^l)+0.98196*B))
ans =
40*imag((- 2 + 5*i)^l) + (60799*imag((- 2 + 5*i)^(l + 1)))/10000 + (24549*imag((- 2 + 5*i)^(d + l)*A))/25000 + (24549*imag(B))/25000
>>
Answers (1)
Mischa Kim
on 26 Mar 2014
Edited: Mischa Kim
on 26 Mar 2014
Stefan, the problem is that the real and imaginary parts depend on the values of the variables, of course. Let me illustrate with a simple example. Assume n is an integer:
syms n
x = i^n;
imag(x)
ans =
imag(i^n)
y = subs(x,n,3); % i^1 = i, i^2 = -1, i^3 = -i
imag(y)
ans =
-1
i^n can be either real, or, imaginary, depending on whether n is even, or, odd. So, in general, you will not get a numeric result for real and imaginary parts unless you numerically specify all variables involved.
Categories
Find more on Function Creation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!