Can anyone see my error?

I've tried various combinations, but still get wrong answers. The attached Fuel_Test_Read.m script file reads the first 10x2 matrices (X77, X85 & X93) and 4 fuel lines (RFLS & FD) all from FuelTest.m script data file. The read file calls function [X77,X85,X93]=FUEL(N1,NF,NC,MODL,RFLD,FD,X77,X85,X93), computes 4 new matrices like RESV, RESM & REST, then insets them into X77, X85 & X93 for 10x6 matrices. Partial results are:
X93 =
-0.1570 -0.1570 0 0 0 0
-0.5960 -0.5960 0 0 0 0
-1.2910 -1.2910 0 0 0 0
-10.4000 -10.4000 0 0 0 0
-11.6260 -11.6260 0 0 0 0
-13.2030 -13.2030 0 0 0 0
-23.3310 -23.3310 0 0 0 0
-25.4740 -25.4740 0 0 0 0
-27.4900 -27.4900 -0.1534 -0.1534 -0.1534 -0.1534
-31.1240 -41.1240 -1.2518 -1.2518 -1.2518 -1.2518
They should be:
X93 =
-0.1570 -0.1570 -0.3243 0 0 0
-0.5960 -0.5960 -1.6221 0 0 0
-1.2910 -1.2910 -2.8200 0 0 0
-10.4000 -10.4000 -2.8200 0 0 0
-11.6260 -11.6260 -2.8200 -1.6609 0 0
-13.2030 -13.2030 -2.8200 -5.2761 0 0
-23.3310 -23.3310 -2.8200 -10.8233 0 0
-25.4740 -25.4740 -2.8200 -12.0600 -5.4434 0
-27.4900 -27.4900 -2.8200 -12.0600 -13.3506 -2.4127
-31.1240 -41.1240 -2.8200 -12.0600 -13.3506 -16.0450
Any help would be appreciated.

3 commentaires

Star Strider
Star Strider le 20 Juil 2016
Please describe what it is you want to do. You don’t have to be exhaustive, but writing something like:
‘I want elements ... in ‘X93’’ to be defined as elements from ... with conditions ...’
I looked through your code and that’s definitely not obvious.
Kenneth Lamury
Kenneth Lamury le 21 Juil 2016
Thanks for responding. I want the FUEL.m function to compute distributed fuel loads based on tankage capacities (FuelTest.m) from known distributed loadings that are in 5% increments. These interpolated loadings are then added (appended?) to existing matrices (X77, X85 & X93). FUEL first computes percent capacities. It then interpolates for the distributed loadings. Finally, it enlarges an existing 10x2 matrix with those loadings to create three 10x6 matricies. I have know idea where it finds that the new matrices produce the same erroneous answers.
Kenneth Lamury
Kenneth Lamury le 21 Juil 2016
By brute force, I made it work to my satisfaction by rewriting certain portions of function FUEL.m. (See attachment for final version.)

Réponses (0)

Cette question est clôturée.

Produits

Clôturé :

le 20 Août 2021

Community Treasure Hunt

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

Start Hunting!

Translated by