How to make contour plot of given matrices
Mostra commenti meno recenti
f= [0;
0.0492;
0.0969;
0.1431;
0.188;
0.2316;
0.274;
0.3152;
0.3554;
0.3946;
0.4328;
0.4702;
0.5067;
0.5424;
0.5775;
0.6118;
0.6455;
0.6786;
0.7111;
0.7432;
0.7747;
0.8058;
0.8365;
0.8668;
0.8968;
0.9264;
0.9557;
0.9847;
1.0135;
1.042;
1.0703;
1.0984;
1.1263;
1.1541;
1.1816;
1.2091;
1.2364;
1.2635;
1.2906;
1.3175;
1.3444;
1.3712;
1.3979;
1.4245;
1.4511;
1.4776;
1.504;
1.5305;
1.5568;
1.5831;
1.6094;
1.6357;
1.6619;
1.6881;
1.7143;
1.7405;
1.7666;
1.7927;
1.8188;
1.8449;
1.871;
1.8971;
1.9231;
1.9492;
1.9752;
2.0013;
2.0273;
2.0533;
2.0793;
2.1054;
2.1314;
2.1574;
2.1834;
2.2094;
2.2354;
2.2614;
2.2874;
2.3134;
2.3394;
2.3654;
2.3914;
2.4174;
2.4434;
2.4694;
2.4954;
2.5214;
2.5473;
2.5733;
2.5993;
2.6253;
2.6513;
2.6773;
2.7033;
2.7293;
2.7553;
2.7813;
2.8072;
2.8332;
2.8592;
2.8852;
2.9112]
h=[0;
0.001;
0.004;
0.0091;
0.0163;
0.0257;
0.0372;
0.0509;
0.0669;
0.0852;
0.1058;
0.1287;
0.154;
0.1817;
0.2118;
0.2444;
0.2794;
0.317;
0.357;
0.3996;
0.4447;
0.4924;
0.5426;
0.5954;
0.6508;
0.7088;
0.7694;
0.8326;
0.8984;
0.9668;
1.0378;
1.1115;
1.1878;
1.2666;
1.3481;
1.4323;
1.519;
1.6083;
1.7003;
1.7948;
1.892;
1.9917;
2.0941;
2.199;
2.3066;
2.4167;
2.5294;
2.6446;
2.7625;
2.8829;
3.0058;
3.1314;
3.2594;
3.3901;
3.5233;
3.659;
3.7973;
3.9381;
4.0814;
4.2273;
4.3757;
4.5267;
4.6801;
4.8361;
4.9946;
5.1557;
5.3192;
5.4853;
5.6539;
5.825;
5.9986;
6.1747;
6.3534;
6.5345;
6.7182;
6.9043;
7.093;
7.2842;
7.4778;
7.674;
7.8727;
8.0739;
8.2776;
8.4838;
8.6925;
8.9037;
9.1174;
9.3336;
9.5523;
9.7735;
9.9972;
10.2235;
10.4522;
10.6834;
10.9171;
11.1533;
11.392;
11.6332;
11.8769;
12.1232;
12.3719
]
how i can make contour plot in (x,y)
if we have following relation
g(x,y)=x*f(y)+0.95*h(y)
Note# (See attached figure of plot)
Risposta accettata
Più risposte (1)
Mike Garrity
il 12 Ott 2015
It's going to look something like this:
nrows = length(f);
ncols = 150;
x = linspace(-10,10,ncols)
y = linspace(0,9,nrows);
g = repmat(x,[nrows,1]).*repmat(f,[1,ncols]) + .95*repmat(h,[1,ncols]);
contour(x,y,g)
Although the X & Y coordinates appear to be a bit off from your picture.
The basic idea is you can use repmat to expand a row vector or a column vector into a 2D array. Once you've got all of your variables as 2D arrays, you can do the math on them and hand them to contour.
Does that make sense?
Categorie
Scopri di più su Surface and Mesh Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!