I would like the plot to look better, colour or in anyway
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Tlotlo Oepeng
el 30 de En. de 2023
Comentada: Tlotlo Oepeng
el 2 de Feb. de 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 comentarios
Respuesta aceptada
Cris LaPierre
el 30 de En. de 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
Más respuestas (0)
Ver también
Categorías
Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!