how to plot the imaginary part of an array numbers as a minus y-axis data

1 vue (au cours des 30 derniers jours)
zina shadidi
zina shadidi le 5 Oct 2021
Commenté : Mathieu NOE le 7 Oct 2021
in developing a matlab code I need to plot the imaginary part of the frequency range in the negative y-axis range . the real part ( in the positive y-axis) and the imaginary part ( in the negative y- axis range)
here is the function in which the real part is ploted successfully, but the imag part is stuck
function []=plot_dispersion(Nk,k_norm,name_special_k,f)
f=real(f);
f1=imag(f);
max_nu=max(max(f));
plot(ones(100,1)*k_norm(1),linspace(0,max_nu*1.1,100),'k-','linewidth',2);
hold on;
for n=1:size(name_special_k,2)-1
plot(linspace(k_norm(n),k_norm(n+1),Nk),f(:,(n-1)*Nk+1:n*Nk),'b.');
plot(ones(100,1)*k_norm(n+1),linspace(0,max_nu*1.1,100),'k-','linewidth',2);
end
set(gca,'xtick',[],'fontsize',12);
ylabel('\nu (THz)','fontsize',12);
xlabel ( ' (wavevector) ' )
axis tight;
for n=1:size(name_special_k,2)
text(k_norm(n),-max_nu*0.05,name_special_k(n),...
'interpreter','latex','fontsize',12);
end
  5 commentaires
zina shadidi
zina shadidi le 6 Oct 2021
Thanks a lot , Mathieu NOE
interp1 was a good choice, and my problem solved.

Connectez-vous pour commenter.

Réponses (0)

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by