I would like the plot to look better, colour or in anyway

1 Ansicht (letzte 30 Tage)
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
n = 0.4000
c1 = 4
c1 = 4
c2 = 20.05
c2 = 20.0500
c3 = 10 %values from literature
c3 = 10
k = 0.1 % made up
k = 0.1000
%------------------------------Fns:
v_i = @(KK) -2*c1*k.*KK
v_i = function_handle with value:
@(KK)-2*c1*k.*KK
v_r = @(KK,a) -1*KK.^2 - n - 0.5.*a*sqrt(n)
v_r = function_handle with value:
@(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_i = function_handle with value:
@(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
q_r = function_handle with value:
@(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)
X = function_handle with value:
@(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)
Y = function_handle with value:
@(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)
Om_2 = function_handle with value:
@(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))
abO = function_handle with value:
@(KK,a)2*abs(Om_2(KK,a))
%-------Grid:
KK = -7:0.1:7
KK = 1×141
-7.0000 -6.9000 -6.8000 -6.7000 -6.6000 -6.5000 -6.4000 -6.3000 -6.2000 -6.1000 -6.0000 -5.9000 -5.8000 -5.7000 -5.6000 -5.5000 -5.4000 -5.3000 -5.2000 -5.1000 -5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000
[KK,a] = meshgrid(KK)
KK = 141×141
-7.0000 -6.9000 -6.8000 -6.7000 -6.6000 -6.5000 -6.4000 -6.3000 -6.2000 -6.1000 -6.0000 -5.9000 -5.8000 -5.7000 -5.6000 -5.5000 -5.4000 -5.3000 -5.2000 -5.1000 -5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -7.0000 -6.9000 -6.8000 -6.7000 -6.6000 -6.5000 -6.4000 -6.3000 -6.2000 -6.1000 -6.0000 -5.9000 -5.8000 -5.7000 -5.6000 -5.5000 -5.4000 -5.3000 -5.2000 -5.1000 -5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -7.0000 -6.9000 -6.8000 -6.7000 -6.6000 -6.5000 -6.4000 -6.3000 -6.2000 -6.1000 -6.0000 -5.9000 -5.8000 -5.7000 -5.6000 -5.5000 -5.4000 -5.3000 -5.2000 -5.1000 -5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -7.0000 -6.9000 -6.8000 -6.7000 -6.6000 -6.5000 -6.4000 -6.3000 -6.2000 -6.1000 -6.0000 -5.9000 -5.8000 -5.7000 -5.6000 -5.5000 -5.4000 -5.3000 -5.2000 -5.1000 -5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -7.0000 -6.9000 -6.8000 -6.7000 -6.6000 -6.5000 -6.4000 -6.3000 -6.2000 -6.1000 -6.0000 -5.9000 -5.8000 -5.7000 -5.6000 -5.5000 -5.4000 -5.3000 -5.2000 -5.1000 -5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -7.0000 -6.9000 -6.8000 -6.7000 -6.6000 -6.5000 -6.4000 -6.3000 -6.2000 -6.1000 -6.0000 -5.9000 -5.8000 -5.7000 -5.6000 -5.5000 -5.4000 -5.3000 -5.2000 -5.1000 -5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -7.0000 -6.9000 -6.8000 -6.7000 -6.6000 -6.5000 -6.4000 -6.3000 -6.2000 -6.1000 -6.0000 -5.9000 -5.8000 -5.7000 -5.6000 -5.5000 -5.4000 -5.3000 -5.2000 -5.1000 -5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -7.0000 -6.9000 -6.8000 -6.7000 -6.6000 -6.5000 -6.4000 -6.3000 -6.2000 -6.1000 -6.0000 -5.9000 -5.8000 -5.7000 -5.6000 -5.5000 -5.4000 -5.3000 -5.2000 -5.1000 -5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -7.0000 -6.9000 -6.8000 -6.7000 -6.6000 -6.5000 -6.4000 -6.3000 -6.2000 -6.1000 -6.0000 -5.9000 -5.8000 -5.7000 -5.6000 -5.5000 -5.4000 -5.3000 -5.2000 -5.1000 -5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000 -7.0000 -6.9000 -6.8000 -6.7000 -6.6000 -6.5000 -6.4000 -6.3000 -6.2000 -6.1000 -6.0000 -5.9000 -5.8000 -5.7000 -5.6000 -5.5000 -5.4000 -5.3000 -5.2000 -5.1000 -5.0000 -4.9000 -4.8000 -4.7000 -4.6000 -4.5000 -4.4000 -4.3000 -4.2000 -4.1000
a = 141×141
-7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -7.0000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.9000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.8000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.7000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.6000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.5000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.4000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.3000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.2000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000 -6.1000
% %-------Plot:
surf(KK,a, abO(KK,a))
title("Grow Rate of MI"); xlabel("K"); ylabel("a"), zlabel("G(\Omega)")

Akzeptierte Antwort

Cris LaPierre
Cris LaPierre am 30 Jan. 2023
I'm not sure what you mean by better, but you might consider setting the 'EdgeColor' to 'none'
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)")
Another option might be a contourf plot.
figure
contourf(abO(KK,a),20)
colorbar

Weitere Antworten (0)

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by