MATLAB Answers

Contour plot of stresses in a beam

193 views (last 30 days)
Nikola
Nikola on 10 Nov 2011
Answered: Vishal Jangid on 11 Feb 2018
Hello,
could someone please help me with my problem, I am still a beginner in using MatLAB. I have a set od stress values in a beam. Each stress value is computed at a specific point with it's coordinates x and y. What I want is to plot a contour plot of the stresses in the beam, where the exact stress is located at point (x,y) in the beam. So, basically I have 3 vectors with 2 of them being the x and y coordinates and the third being the value at the point. I need to plot a contour plot with this data. Any help would be appreciated.

  0 Comments

Sign in to comment.

Answers (2)

Fangjun Jiang
Fangjun Jiang on 10 Nov 2011
You can use the TriScatteredInterp function. Just replace mesh() with contour() in the example provided.
x = rand(100,1)*4-2;
y = rand(100,1)*4-2;
z = x.*exp(-x.^2-y.^2);
F = TriScatteredInterp(x,y,z);
ti = -2:.25:2;
[qx,qy] = meshgrid(ti,ti);
qz = F(qx,qy);
figure(1);scatter3(x,y,z);
hold on;
mesh(qx,qy,qz);
figure(2);
contour(qx,qy,qz);

  2 Comments

Nikola
Nikola on 11 Nov 2011
Did not help, I still can't do a contour plot!
Fangjun Jiang
Fangjun Jiang on 11 Nov 2011
In the example provided, x,y and z are similar to yours. They are just three vectors indicating the coordinates and the z value. After some processing, you can generate the needed data and run contour().

Sign in to comment.


Vishal Jangid
Vishal Jangid on 11 Feb 2018
bhai 2018 ho gaya still no progress!

  0 Comments

Sign in to comment.

Sign in to answer this question.