Error with contourf representing 3d plot in 2d
Show older comments
Good afternoon,
I have been trying to compile a contour surface of my 3d object in the sig1-sig2 space (X-Y). When compiling it shows as an error and im not sure why.
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;
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));
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(turbo(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
nexttile
[sig1,sig2] = contourf(G)
Sorry for the long intro, but as you can see the problem is at the last line of the code.
Thank you for the time,
Kevin
Accepted Answer
More Answers (0)
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!
