3D Ploting with a column having the same value

hi, i'm currently having a little trouble or misunderstanding. I want to plot a Matrix using countourf.
Matrix =
L C P
1 1 953.2606
1 2 752.0167
1 3 1
1 4 1.2286e+03
1 5 1
1 6 2.1819e+03
1 7 720.2413
1 8 1.0804e+03
1 9 1.6523e+03
but as you can see the first column is the same value, i tried:
xi=linspace(min(L1),max(L1),30);
yi=linspace(min(C),max(C),30);
[XI YI]=meshgrid(xi,yi);
ZI = griddata(L1,C,P,XI,YI);
figure
contourf(XI,YI,ZI);
L1 beeing the L broken down into 9 to fit:
0,111111111111111
0,222222222222222
0,333333333333333
0,444444444444444
0,555555555555556
0,666666666666667
0,777777777777778
0,888888888888889
1,00000000000000
but still nothing shows. and the same could be true for something like that:
L C P
1 1 953.2606
2 1 1.6523e+03
3 1 1.0804e+03
4 1 953.2606
5 1 1.6523e+03
The thing is i would like a something other than a line when i plot in 3d, i would like a cartography, thus why i use contourf.
Thank you

 Accepted Answer

data = [1 1 953.2606
1 2 752.0167
1 3 1
1 4 1.2286e+03
1 5 1
1 6 2.1819e+03
1 7 720.2413
1 8 1.0804e+03
1 9 1.6523e+03];
L = data(:,1) ;
C = data(:,2) ;
P = data(:,3) ;
X = reshape(L,[3 3]) ;
Y = reshape(C,[3 3]) ;
Z = reshape(P,[3 3]) ;
figure
contour(X,Y,Z) ;
title('It gives a line')
figure
contourf(Z)
title('If you dont consider X and Y')

More Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!