フィルターのクリア

how to interpolate a value from an excel file depending on an input and then assign the result to a variable.

2 ビュー (過去 30 日間)
Hi,
I am trying to model a refrigeration compressor, i am trying to use input values from an excel file to then find the corresponding temperature values in the steam tables. once the corresponding temperature is found, the values of pressure (column B), enthalpy( column I) and entropy (column L) need to found. I need help with one of these columns and I should be able to handle the rest.
% Refrigeration Calculations
Temperatureout = 'Tcout.xlsx';
Tempinlet = xlsread(Temperatureout);
% Tin = Tempinlet(;,1)
%% State 1
R134aTemp = 'R134a_TempSat.xlsx';
%Pin =
As you can see the temperature into the compressor can be found in the Tcout excel file. I am trying to find the corresponding pressure which is in the R134a_Tempsat excel file. Since the exact temperature may not be there linear interpolation may be used.

採用された回答

Guillaume
Guillaume 2019 年 7 月 29 日
In modern matlab, I'd recommend you use readtable instead of xlsread, particularly if your excel file has column headers since these will be read and used to create variable names by readtable. In this case, it's simply:
TempSatLookup = readtable('R134a_TempSat.xlsx');
%assuming that the file has two columns named Temperature and SatPressure:
queryTemp = 100; %some value. Not sure where this come from. Can be a scalar or a matrix
MatchingPressure = interp1(TempSatLookup.Temperature, TempSatLookup.SatPressure, queryTemp)
If you use xlsread, or in modern matlab readmatrix, and temperature is 1st and saturation pressure 2nd column:
TempSatLookup = xlsread('R134a_TempSat.xlsx');
queryTemp = 100; %some value. Not sure where this come from. Can be a scalar or a ma
MatchingPressure= interp1(TempSatLookup(:, 1), TempSatLookup(:, 2), querytemp)
  3 件のコメント
Guillaume
Guillaume 2019 年 7 月 29 日
編集済み: Guillaume 2019 年 7 月 29 日
queryTemp can come from wherever you want. If your query temperatures are all the values you've read in Tempinlet, then replace queryTemp by TempInlet in the above in order to look up the saturation pressure of all these temperatures at once.
If that's not what you're asking then I'm lost and providing example spreadsheets may help understanding your question better.
rammah nagi
rammah nagi 2019 年 7 月 29 日
編集済み: rammah nagi 2019 年 7 月 29 日
Thank you that did the trick!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by