Problem with setting specified intervals with colorbar
Afficher commentaires plus anciens
Good morning,
I am having problems setting specified intervals for my colorbar. I have tried reading the documentation, and looking at previous questions for the function, but nothing seems to work.
Heres the code,
clc; clear;
sig1c = .35031092712186400;
sig1t = .35031092712186400; %.39026571574305700
sig2c = sig1c;
sig2t = sig1t;
% sig3c = .56181805055156500;
% sig3t = .02333758968994630;
sig3c = sig1c; %will reduce to von misses if sig1t = sig1c
sig3t = sig1t;
tau23 = .07; %sheer strenth, tau23 is symetric with tau13
tau13 = tau23;
tau12 = .23;
% Ac = .636384473946997;
% At = .331316020473478;
% Bc = .210346685921127;
% Bt = 0.0628623668872776;
% Cc = Bc;
% Ct = Bt;
Ac = sig1c;
At = sig1c;
Bc = sig1c;
Bt = sig1c;
Cc = sig1c;
Ct = sig1c;
F1 = ((1/sig1t)-(1/sig1c));
F2 = ((1/sig2t)-(1/sig2c));
F3 = ((1/sig3t)-(1/sig3c));
F11 = (1/(sig1c*sig1t));
F22 = (1/(sig2c*sig2t));
F33 = (1/(sig3c*sig3t));
F44 = (1/(tau23^2));
F55 = (1/(tau13^2));
F66 = (1/(tau12^2));
F12 = -0.5*sqrt((F11*F22)); %only defines a range for F12, complete determination for orthotropic materials still needs to be resolved.
F13 = -0.5*sqrt((F11*F33));
F23 = -0.5*sqrt((F22*F33));
%F12 = -7.2806*10^(-4);
%F13 = 7.4203*10^(-4)
%F23 = F13;
% F12 = ((4/(At*Ac))-F11-F22-F66)/2;
%
% F13 = ((4/(Bt*Bc))-F11-F33-F55)/2;
%
% F23 = ((4/(Ct*Cc))-F33-F22-F44)/2;
syms sig1 sig2 sig3 G
[sig1,sig2,sig3] = meshgrid(linspace(-2,2,100));
sig1b = 0;
sig2b = 0;
sig3b = 0;
Data = sqrt(sig1.^2+sig2.^2+sig3.^2);
G = F1.*sig1 + F11.*sig1.^2 + F2.*sig2 + F22.*sig2.^2 + F3.*sig3 + F33.*sig3.^2 + (2*F12.*sig1.*sig2) + (2*F13.*sig1.*sig3) + (2*F23.*sig2.*sig3) - 1;
%G = F1.*sig1 + F11.*sig1.^2 + F2.*sig2 + F22.*sig2.^2 + F3.*sig3 + F33.*sig3.^2 + F44.*tau23.^2 + F55.*tau13.^2 + F66.*tau12.^2 + (2*F12.*sig1.*sig2) + (2*F13.*sig1.*sig3) + (2*F23.*sig2.*sig3) - 1;
G(G>1) = 1;
tiledlayout(1,2)
nexttile
Stich = patch(isosurface(sig1,sig2,sig3,G,0));
isonormals(sig1,sig2,sig3,G,Stich)
isocolors(sig1,sig2,sig3,Data,Stich)
colormap(hot(9))
shading interp
% Stich.FaceColor = 'interp';
% Stich.EdgeColor = 'black';
xlabel("\sigma_1 (GPa)");
ylabel("\sigma_2 (GPa)");
zlabel("\sigma_3 (GPa)");
title('Tsai-Wu Ultimate Yield Surface');
view(3);
axis padded
grid on
colorbar('Ticks',linspace(0,10,11),...
'TickLabels',["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "10"]);
nexttile
H = squeeze(sum(G,3));
contourf(linspace(-2,2,100),linspace(-2,2,100),H);
axis equal
colorbar
xlabel("\sigma_1 (GPa)");
ylabel("\sigma_2 (GPa)");
title('Sum of sig3 data');
Here you can see how the numbers on the colorbar are still floating.
Thanks for the help,
Kevin
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Color and Styling dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



