Having A problem with surfc

X = 0:10; %This a range from 1 to 100 cities in MA
Y = 0:25; %In the year 2012
%1 2 3 4 5 6 7 8 9 10
Z = [27 630 72 12 32 26 253 567 203 28;
315 132 16 113 642 38 560 19 5 87;
2076 1992 58 243 352 185 218 15 28 32;
543 618 37 13 53 5647 490 48 21 11;
742 450 30 1082 4 148 12 50 1196 566;
92 201 84 58 189 704 394 64 8 68;
102 193 113 48 50 267 66 27 44 74;
2808 460 177 254 20 66 52 460 33 14;
27 16 53 302 95 93 174 35 22 17;
1122 306 956 1195 682 2 544 1213 938 152];
Xi = 0:.1:10;
Yi = 0:.1:10;
[Xi, Yi] = meshgrid(Xi, Yi);
surfc(Xi, Yi);

Réponses (1)

Rik
Rik le 25 Nov 2017

0 votes

Read the documentation. I suspect your problem will be solved by using the surfc(X,Y,Z) syntax. The code below produces a plot, see if it suites your need.
Z = [27 630 72 12 32 26 253 567 203 28;...
315 132 16 113 642 38 560 19 5 87; ...
2076 1992 58 243 352 185 218 15 28 32; ...
543 618 37 13 53 5647 490 48 21 11; ...
742 450 30 1082 4 148 12 50 1196 566; ...
92 201 84 58 189 704 394 64 8 68; ...
102 193 113 48 50 267 66 27 44 74; ...
2808 460 177 254 20 66 52 460 33 14; ...
27 16 53 302 95 93 174 35 22 17; ...
1122 306 956 1195 682 2 544 1213 938 152];
vec=linspace(0,10,10);%edit to fit your data
[Xi, Yi] = meshgrid(vec, vec); surfc(Xi, Yi,Z);
(I made sure the code is readable by selecting the code and then using the {}Code button. Please do so as well next time you post code.)

Cette question est clôturée.

Tags

Clôturé :

le 20 Août 2021

Community Treasure Hunt

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

Start Hunting!

Translated by