Graphing exponential function with imaginary term
2 ビュー (過去 30 日間)
古いコメントを表示
Nachiket Kortikar
2020 年 8 月 3 日
コメント済み: Nachiket Kortikar
2020 年 8 月 8 日
I am trying to plot a function where my amplitude is dependant on varaiable say z. and the phase is depentant on theta which is varying form -pi/2 to pi/2.
I get error as
empty double row vector
I saw some other plots. I don't understnd why it doens't work for me.
clear all;
clc;
close all;
pi = 3.1415;
theta = linspace(-pi/2,pi/2,0.01)
z = linspace(-pi/2,pi/2,0.01)
g2 = 5;
g3 = 0.5;
sigma0 = 0.05;
B = -(3*g2*sigma0-8*g3*sigma0)/((2*g2*sigma0))
D = (3*g2*sigma0-8*g3*sigma0)^2/((6*g2))
sigma0 = 0.05;
sigma = sigma0*(1-(B./(1+D.*z.^2)))
psi = sqrt(sigma).*exp(1i.*theta)
figure()
plot3(theta,real(psi),imag(psi))
% plot3(z,theta,imag(psi))
% hold on
grid on
xlabel('\psi', 'Rotation',-30)
ylabel('Real Axis', 'Rotation',10)
zlabel('Imag Axis')
0 件のコメント
採用された回答
Cris LaPierre
2020 年 8 月 3 日
I suspect it has to do with how you define theta and z. Check out the documentation for linspace. The last number is the nubmer of data points you want. You have asked for 0.01, which is not possible, so theta and z are both empty vectors.
theta = linspace(-pi/2,pi/2,300);
z = linspace(-pi/2,pi/2,300);
If you want a specific increment, use the colon operator instead
theta = -pi/2:0.01:pi/2;
z = -pi/2:0.01:pi/2;
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!