how to plot compelex function
1 次查看(过去 30 天)
显示 更早的评论
I want to add some information that make this question more clear
1- I use p=[(0.9-0.124i) (0.4243 + 0.0017i) (0.10 + 0.3i)]; and as t change time = 0:0.01:2*pi (polynomial in z inthe second degree) f(z) = (0.10 + 0.3i) + (0.4243 + 0.0017i)z + (0.9-0.124i)z^2
the coefficients of p will cange with time by using this relation | f(t)> =exp(i t H)|f(0)>,for some H (given) and |f(0)> are the coefficients of p at t=o, and at every time I have new coefficients | f(t)> and plot the function p.
2- the function f(1/z) at every time must use the complex conjugate of the coeffecients of p (multiply in some constants)which also change with time t by the same way that coefficients of p do(in this case f(1/z) is the function of 1/z in the third degree) f(1/z) = (0.10 − 0.3i)z^-1 + (0.2121 − 0.0008i)z^−2 + (0.9 + 0.001i)z^−3.
How can I plot the two function in this case?
When I am trying to plot f(z) and f(1/z) I got paths in complex plane (not serface). and I am not sure that plots are correct.
I will appreciate any help
1 个评论
Torsten
2022-3-25
编辑:Torsten
2022-3-25
So f will depend on t and on z :
f(z,t) = exp(i*t*H) * p * [z.^2;z;1]
?
And
g(z,t) = exp(i*t*H) * conj(p) * [z.^3;z.^2;z]
?
And how do you want to plot f(z,t) and g(1/z,t) ?
If the above form of the functions is true, f and g are functions from C x R -> C.
I don't understand how you want to plot them.
回答(1 个)
Abhishek Chakram
2023-12-19
Hi Aisha Mohamed,
It appears to me that you're dealing with a time-dependent complex polynomial function “f(z)” and its reciprocal ”f(1/z)”, where the coefficients change with time according to a quantum mechanical evolution expressed by “|f(t)> = exp(i t H)|f(0)>”. Here are the steps on how to plot these functions:
- Define the initial coefficients for “f(z)” as given by your polynomial “p” at time t=0.
- Compute the time evolution of the coefficients. This involves defining the Hamiltonian H and using the relation “|f(t)> = exp(i t H)|f(0)>”. The Hamiltonian H should be a matrix that describes the evolution of the system. This matrix is needed to proceed with the calculation.
- Update the coefficients at each time step to get the new coefficients for ”f(z)”.
- Calculate the complex conjugate of the coefficients for “f(1/z)”, and apply any necessary constants to get the coefficients for the reciprocal polynomial.
- Evaluate “f(z)” and “f(1/z)” at a range of “z” values for each time step. Since these are complex functions, plotting their real and imaginary parts, which will give paths in the complex plane.
- Plot the functions for each time step using the “plot” function where the x-axis represents the real part, and the y-axis represents the imaginary part of the function values.
Here is a sample code for the same:
% Define the initial coefficients for f(z) at t=0
p0 = [0.9 - 0.124i, 0.4243 + 0.0017i, 0.10 + 0.3i];
% Define the time array
time = 0:0.01:2*pi;
% Define a simple Hermitian Hamiltonian matrix H
H = [1, 0.1 - 0.2i, 0.1 + 0.3i;
0.1 + 0.2i, 2, 0.1 - 0.1i;
0.1 - 0.3i, 0.1 + 0.1i, 3];
% Preallocate arrays for plotting
f_z_real = zeros(length(time), 1);
f_z_imag = zeros(length(time), 1);
f_invz_real = zeros(length(time), 1);
f_invz_imag = zeros(length(time), 1);
% Define a range of z values to evaluate the polynomials
% For this example, let's assume we evaluate at z = 1
z = 1;
for t_idx = 1:length(time)
t = time(t_idx);
% Compute |f(t)> using the matrix exponential
f_t = expm(1i * t * H) * p0.';
% Update the coefficients of f(z)
f_z = polyval(f_t, z);
% Compute the complex conjugate and apply constants to get coefficients for f(1/z)
% Assuming the constants are 1 for simplicity, adjust as needed
f_invz = polyval(conj(f_t), 1/z);
% Store the real and imaginary parts for plotting
f_z_real(t_idx) = real(f_z);
f_z_imag(t_idx) = imag(f_z);
f_invz_real(t_idx) = real(f_invz);
f_invz_imag(t_idx) = imag(f_invz);
end
% Plot the real vs. imaginary parts of f(z)
figure;
plot(f_z_real, f_z_imag);
title('Evolution of f(z) in the Complex Plane');
xlabel('Real Part');
ylabel('Imaginary Part');
% Plot the real vs. imaginary parts of f(1/z)
figure;
plot(f_invz_real, f_invz_imag);
title('Evolution of f(1/z) in the Complex Plane');
xlabel('Real Part');
ylabel('Imaginary Part');
You can refer to the following documentation to know more about the functions used:
Best Regards,
Abhishek Chakram
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polynomials 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!