plotting data

1 次查看(过去 30 天)
milad babaei
milad babaei 2011-7-3
hi all, i have a table with 3 variables(B/H)= 1,2,3,4,5,6,7,8 and fi= 0,10,20,30 and h which is depend on (B/H) and fi that contains 32 values. for example for fi=0 and (B/H)=1 >>h=1 fi=0 and (B/H)=2 >>h=1.02 ...... fi=30 and (B/H)=8 >>h=14800
h:[ 1 1.02 1.11 1.21 1.3 1.4 1.59 1.78
1 1.11 1.35 1.62 1.95 2.33 3.34 4.77
1.01 1.39 2.12 3.29 5.17 8.29 22 61
1.13 2.5 6.36 17.5 50 150 1400 14800 ]
> i would like to plot 3d data.then fit them with 2nd-order polynomial or surface equation for h in terms of fi and (B/H).would anyone please help me to solve that?
tnx in advance,

回答(2 个)

Rick Rosson
Rick Rosson 2011-7-3
Please try:
sftool
or
cftool
HTH.

Brenden
Brenden 2011-7-4
You can make the plane you will plot h on with meshgrid ex:
[(B/H),fi]= meshgrid(domain of (B/H),domain of fi)
Then you will define the function h using (B/H) and fi or for simplicity you can change the above to X and Y. then you plot the data with:
surf(X,Y,h)
then you can fit this data with something similar to polyfit but you will have to look up the 3d fit
  2 个评论
milad babaei
milad babaei 2011-7-5
tnx for your help,,would u plz tell how could i define h values??please explain more
Brenden
Brenden 2011-7-8
if h is a 3d array that is dependent on B/H and fi then you must have some function for this??.. what ever the function is it will most likely require a loop to fill a previously created zero array then you simply surf with your function h and X and Y being the independent variables ...
if you are working with recorded data then the size matters and so you will use meshgrid to make a grid for plotting the recorded data. note that meshgrid will add a zero term in the center of the domain you specify
ex: if you have a image that is 20 pixels wide and high then
[x,y] = meshgrid(-((pixel_dimension-1)/2):((pixel_dimension-1)/2),-((pixel_dimension-1)/2):((pixel_dimension-1)/2));
then mesh grid will make the correct size domain

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

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

Start Hunting!

Translated by