I would like the plot to look better, colour or in anyway
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Tlotlo Oepeng
le 30 Jan 2023
Commenté : Tlotlo Oepeng
le 2 Fév 2023
i have this code and would like hlep making it look a bit better its not really easy to see evrthing going on there. wheather colour or even a ffrent 3D plot. and also if you add a code for 2d plot at fixed y variable. thank you
n = 0.4
c1 = 4
c2 = 20.05
c3 = 10 %values from literature
k = 0.1 % made up
%------------------------------Fns:
v_i = @(KK) -2*c1*k.*KK
v_r = @(KK,a) -1*KK.^2 - n - 0.5.*a*sqrt(n)
q_i = @(KK,a) ( 4*n*(c1 - c2) + 2.*a*sqrt(n)*(c1 - c3))*k.*KK
q_r = @(KK,a) (1 + c1^2).*KK.^4 - 4*(1 + c1^2)*k^2.*KK.^2 + 2*n*(1 + c1*c2).*KK.^2 + sqrt(n).*a*(1 + c3*c1 ).*KK.^2
X = @(KK,a) v_r(KK,a).^2 - v_i(KK).^2 - q_r(KK,a)
Y = @(KK,a) 2*v_i(KK).*v_r(KK,a) - q_i(KK,a)
%Om_1 = @(KK,a) v_r(KK,a) - sqrt( X(KK,a) + sqrt(X(KK,a).^2 + Y(KK,a).^2))/sqrt(2)
Om_2 = @(KK,a) v_r(KK,a) + sqrt( X(KK,a) + sqrt(X(KK,a).^2 + Y(KK,a).^2))/sqrt(2)
abO = @(KK,a) 2*abs(Om_2(KK,a))
%-------Grid:
KK = -7:0.1:7
[KK,a] = meshgrid(KK)
% %-------Plot:
surf(KK,a, abO(KK,a))
title("Grow Rate of MI"); xlabel("K"); ylabel("a"), zlabel("G(\Omega)")
0 commentaires
Réponse acceptée
Cris LaPierre
le 30 Jan 2023
n = 0.4;
c1 = 4;
c2 = 20.05;
c3 = 10; %values from literature
k = 0.1; % made up
%------------------------------Fns:
v_i = @(KK) -2*c1*k.*KK;
v_r = @(KK,a) -1*KK.^2 - n - 0.5.*a*sqrt(n);
q_i = @(KK,a) ( 4*n*(c1 - c2) + 2.*a*sqrt(n)*(c1 - c3))*k.*KK;
q_r = @(KK,a) (1 + c1^2).*KK.^4 - 4*(1 + c1^2)*k^2.*KK.^2 + 2*n*(1 + c1*c2).*KK.^2 + sqrt(n).*a*(1 + c3*c1 ).*KK.^2;
X = @(KK,a) v_r(KK,a).^2 - v_i(KK).^2 - q_r(KK,a);
Y = @(KK,a) 2*v_i(KK).*v_r(KK,a) - q_i(KK,a);
%Om_1 = @(KK,a) v_r(KK,a) - sqrt( X(KK,a) + sqrt(X(KK,a).^2 + Y(KK,a).^2))/sqrt(2)
Om_2 = @(KK,a) v_r(KK,a) + sqrt( X(KK,a) + sqrt(X(KK,a).^2 + Y(KK,a).^2))/sqrt(2);
abO = @(KK,a) 2*abs(Om_2(KK,a));
%-------Grid:
KK = -7:0.1:7;
[KK,a] = meshgrid(KK);
% %-------Plot:
surf(KK,a, abO(KK,a),'EdgeColor','none')
title("Grow Rate of MI"); xlabel("K"); ylabel("a"), zlabel("G(\Omega)")
figure
contourf(abO(KK,a),20)
colorbar
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Contour Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


