I would like the plot to look better, colour or in anyway
1 view (last 30 days)
Show older comments
Tlotlo Oepeng
on 30 Jan 2023
Commented: Tlotlo Oepeng
on 2 Feb 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 Comments
Accepted Answer
Cris LaPierre
on 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
More Answers (0)
See Also
Categories
Find more on Contour Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

