clear i
syms x t
U=zeros(1,2,'sym');
A=zeros(1,2,'sym');
series(x,t)=sym(zeros(1,1));
U(1)=exp(i*x);
alpha=1;
for k=1:2
A(1)=0;
for r=1:k
for s=1:r
A=A+U(s)*U(r-s+1)*U(k-r+1);
end
end
U(k+1)=simplify(i*(gamma(alpha*(k-1)+1)/gamma((alpha*(k))+1))*(sym(1/2)*diff(U(k),x,2)))
end
for k=1:3
series(x,t)=simplify(series(x,t)+U(k)*power(t,k-1))
end
series i obatin is form of the complex function and want to separte the real and imigimary part of the complex number But the command Re(series) does work . I want to plot the graph of the real part and imaginary part separtely of the series . For that i use the command expand (series) but it is also not working

 채택된 답변

Torsten
Torsten 2024년 10월 5일
이동: Torsten 2024년 10월 5일

0 개 추천

Use
syms x t real
instead of
syms x t
Then real(series) and imag(series) will work.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2024년 10월 5일

0 개 추천

You can use real() and imag(), but they will not help much.
A problem is that you do not constrain x or t to be real-valued, so real() and imag() are not able to simplify the expressions.

댓글 수: 5

yogeshwari patel
yogeshwari patel 2024년 10월 5일
U is the complex function of x and t . U(1)= e^(i*x) = cos (x) +i* sin(x) .So how should I define that x is real or imaginary
yogeshwari patel
yogeshwari patel 2024년 10월 5일
If I replace U(1) by U(1)=cos(x)+i*sin(x). Is it possible to separte the real and imaginary part?
yogeshwari patel
yogeshwari patel 2024년 10월 5일
U(1)=cos(x)+isin(x) it is showing the error
syms x t
U=zeros(1,2,'sym');
U(1)=cos(x)+1i*sin(x)
yogeshwari patel
yogeshwari patel 2024년 10월 5일
Thanks

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

카테고리

질문:

2024년 10월 5일

댓글:

2024년 10월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by