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