I have X and Y co-ordinates as vector,
  • y=[0;0;0;.1;.1;.1;.2;.2;.2];
  • x= [0;0.15;.3;.2;.4;.25;.5]; and
  • T=[578.6669;560.5492;539.8550;278.7484;269.1011;145.0386;37.6087;31.3801;24.8135];How do I PLOT temperature distribution, I want it to look something like this,

 Réponse acceptée

To begin, try this:
y=[0;0;0;.1;.1;.1;.2;.2;.2];
x= [0;0.15;.3;.2;.4;.25;.5];
T=[578.6669;560.5492;539.8550;278.7484;269.1011;145.0386;37.6087;31.3801;24.8135];
yr = reshape(y, 3, []);
Tr = reshape(T, 3, []);
figure
contourf(Tr.')
I used ‘y’ to figure out how to use reshape with ‘T’ There appears to be a problem with ‘x’, because it does not demonstrate the same pattern as ‘y’, and only has 7 elements (thje others have 9). When you correct ‘x’ and reshape it, you can use:
figure
contourf(xr, yr, Tr.')

2 commentaires

Wow,Thanks! One thing is that instead of Tr.' using Tr gives proper result.
As always, my pleasure!
If you have the two other matrices, ‘Tr’ will plot correctly.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by