Import grid data and surface fit
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi,
Looking for help on what is probably an easy problem. I can't even get data into Matlab correctly to start!
I have MS Excel grid - temperature (orange), %alcohol (blue), density (green). This is excerpt:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/194966/image.png)
I would like to create a function/formula: input density and temperature, output %alcohol. This function should interpolate/extrapolate, so for example could enter temperatures like 34.6, 40.7
So guess I would like to fit a surface and get function equation, and then reorganize so %alcohol is on LHS.
Questions:
1. First problem how to import data into grid format I can use? I have tried to bring in as table, but treats every column as different variable.
2. How to best fit a function to this data and "solve" for %alcohol.
Any suggestions, similar examples, outline workflows appreciated.
Thanks, Michael
댓글 수: 0
채택된 답변
Walter Roberson
2018년 9월 4일
data = xlsread('YourFile.xlsx');
alch = data(2:end,1);
temperature = data(1,2:end);
density = data(2:end,2:end);
surf(temperature, alch, density, 'edgecolor','none')
xlabel('temperature'); ylabel('% alcohol')
추가 답변 (1개)
ahmed nebli
2018년 9월 2일
1- u need to use the function xlsread , see this link : https://www.mathworks.com/help/matlab/ref/xlsread.html
댓글 수: 3
ahmed nebli
2018년 9월 3일
i think once you imported the xls sheet, u need to store it in a .mat file , then you can treat the double sttored in the .mat like you want
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!