From: Ryan Buesseler on
I am plotting some stress data. I have the x and y coordinates of each stress value. I want to plot the data similar to how a FEA program would plot isostress contours. When I use the meshc() function, I can see the correct data on the x-y plane (the x and y range in correct, from 0-1 and 4-6.5 respectively). When I switch to using contour() I get the same appearance of the graph, but the range of the axis is incorrect. Instead, it goes from 0-(number of data points). In the X-direction it goes from 0-110, and from 0-225 in the y-direction. How do I get contour() to work correctly:


x=0 0 0 1 1 1 .5 .5 .5 .5;
y=4.375 5 5.625 4.375 5 6.125 4 4.75 5.25 6.5;
z=.25 .5 .25 .25 .5 .75 0 0 0 .4142

tix=0:.1:1;
tiy=4:.1:6.25
[XI,YI]=meshgrid(tix,tiy);
ZI=griddata(z,y,z,XI,YI);
meshC(XI,YI,ZI);
%contour(ZI);

The data in x, y, and z are arrays, and I don't know how to better put them on here. So, try copying and pasting my code, and help me figure out how I can get the contour() to appear like the x-y portion of the meshc(). Thanks in advance!!
From: pipa on
Did u try:
contour(XI,YI,ZI);
From: Ryan Buesseler on
"Ryan Buesseler" <bues0022(a)umn.edu> wrote in message <hm6mcs$bcp$1(a)fred.mathworks.com>...
> I am plotting some stress data. I have the x and y coordinates of each stress value. I want to plot the data similar to how a FEA program would plot isostress contours. When I use the meshc() function, I can see the correct data on the x-y plane (the x and y range in correct, from 0-1 and 4-6.5 respectively). When I switch to using contour() I get the same appearance of the graph, but the range of the axis is incorrect. Instead, it goes from 0-(number of data points). In the X-direction it goes from 0-110, and from 0-225 in the y-direction. How do I get contour() to work correctly:
>
>
> x=0 0 0 1 1 1 .5 .5 .5 .5;
> y=4.375 5 5.625 4.375 5 6.125 4 4.75 5.25 6.5;
> z=.25 .5 .25 .25 .5 .75 0 0 0 .4142
>
> tix=0:.1:1;
> tiy=4:.1:6.25
> [XI,YI]=meshgrid(tix,tiy);
> ZI=griddata(z,y,z,XI,YI);
> meshC(XI,YI,ZI);
> %contour(ZI);
>
> The data in x, y, and z are arrays, and I don't know how to better put them on here. So, try copying and pasting my code, and help me figure out how I can get the contour() to appear like the x-y portion of the meshc(). Thanks in advance!!


I am having one heck of a time today. I got the contour to work. I had to put contour(tix,tiy,ZI); I had the wrong x and y values before, that's why it was showing up weird. Now my problem is almost the exact opposite. Now my meshc(XI,YI,ZI); is showing up only as a 2D plot, what gives? The rest of the code remains the exact same. Ideas?