Error Using Interp1
Show older comments
I am new to MATLAB I am trying to run a simple code but keep getting the following error:
Error using griddedInterpolant/subsref Invalid arguments specified in evaluating the interpolant.
Error in interp1 (line 151) VqLite = F(Xqcol);
Error in test34 (line 13) Gp1BexC2H6-((1/22.6127535749917)*250*(interp1(x_data_C2H6,y_data_C2H6,vq)))==0;
the script is as follows
Methane_40C = [49.9250000000000,3.41300000000000;48.1190000000000,3.47400000000000;46.1580000000000,3.53100000000000;44.2580000000000,3.58900000000000;41.9420000000000,3.68100000000000;38.0910000000000,3.83700000000000;36.0150000000000,3.96900000000000;34.0170000000000,4.08100000000000;32.0230000000000,4.24200000000000;30.1820000000000,4.38300000000000;28.0730000000000,4.58000000000000;26.0850000000000,4.78700000000000;24.0580000000000,5.00300000000000;21.9750000000000,5.22600000000000;17.8660000000000,5.71700000000000;16.0030000000000,5.96400000000000;14.0790000000000,6.16800000000000;12.0840000000000,6.34800000000000;9.81600000000000,6.47500000000000;7.91300000000000,6.45200000000000;6.03300000000000,6.29700000000000;5.13300000000000,6.12300000000000;4.06100000000000,5.87900000000000;3.05000000000000,5.43600000000000;1.91900000000000,4.62500000000000;0.739000000000000,3.14900000000000;0.0310000000000000,0.997000000000000]; Ethane_40C = [[49.9960000000000,1.58400000000000;46.9420000000000,1.62100000000000;43.4100000000000,1.64400000000000;40.3150000000000,1.69600000000000;37.6160000000000,1.73900000000000;35.2460000000000,1.78600000000000;32.5590000000000,1.83400000000000;30,1.88200000000000;27.7270000000000,1.93700000000000;25.1650000000000,2.01900000000000;22.6710000000000,2.10900000000000;20.3830000000000,2.18400000000000;18.2300000000000,2.27200000000000;16.4810000000000,2.36900000000000;14.8120000000000,2.45900000000000;13.0290000000000,2.58600000000000;11.4070000000000,2.75400000000000;10.3070000000000,2.88200000000000;9.12600000000000,3.06700000000000;6.99500000000000,3.69000000000000;5.93000000000000,4.77100000000000;4.11100000000000,7.29300000000000;3.07900000000000,7.49600000000000;2.06100000000000,7.40600000000000;1.05400000000000,6.72100000000000;0.185000000000000,4.73300000000000]]; x_data_CH4=Methane_40C(:,1); y_data_CH4=Methane_40C(:,2); x_data_C2H6=Ethane_40C(:,1); y_data_C2H6=Ethane_40C(:,2);
Ptot1B==12; y1BCH4=2; vq==((1-y1BCH4)*Ptot1B); vq2==((y1BCH4)*Ptot1B);
Gp1BexC2H6-((1/22.6127535749917)*250*(interp1(x_data_C2H6,y_data_C2H6,vq)))==0; Gp1BexCH4-(((1/42.3918640897756)*250*(interp1(x_data_CH4,y_data_CH4,vq2))))==0;
Answers (1)
Walter Roberson
on 6 Aug 2018
Ptot1B==12; y1BCH4=2; vq==((1-y1BCH4)*Ptot1B); vq2==((y1BCH4)*Ptot1B);
Notice most of those are not assignment statements. You compare variables to something and throw away the results of the comparison.
Categories
Find more on Discrete Data Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!