why does matlab give me a negative number?

129 Views Asked by At

I have the following problem

A steel company has four different types of scrap metal (called Typ-1 to Typ-4) with the following compositions per unit of volume

They need to determine the volumes to blend from each type of scrap metal so that the resulting mixture has the following amounts of Al, Si, C, and Fe: Al - 9 , Si - 6 , C - 8.0 , Fe - 190.0. Determine volumes of each the 4 scrap metals Typ-1, Typ-2, Typ-3, Typ-4 to blend in order to reach the desired amounts of Al, Si, C, Fe. Formulate the system and solve it using matlab (’back-slash’).

However when I go to Matlab, I am using Octave, and enter the following commands

m = [5 3 4 88; 7 6 5 82; 2 1 3 94; 1 2 1 96] R = [9;6;8;190]

m\R ans =

22.6980 18.6980 -90.7020 2.2980

How can the amount for type3 be negative?

2

There are 2 best solutions below

0
On

You should not be trying to solve the system $mx = R$. That is nonsensical because you are not adding together columns of the matrix $m$. Try solving $m^Tx = R$ instead.

0
On

Goal

The matrix $\mathbf{A}$ is a map between the $m=4$ material types and $n=4$ metals.

The fraction of the $m=4$ types (I-IV) is $f$. The relative abundance or parts of the $n=4$ elements is $p$.

Blend $m=4$ type to get a material with composition $a$.

Data

$$ % \begin{align} % \mathbf{A} f &= p \\ % \left( \begin{array}{rrrr} 5 & 7 & 2 & 1 \\ 3 & 6 & 1 & 2 \\ 4 & 5 & 3 & 1 \\ 88 & 82 & 94 & 96 \\ \end{array} \right) % \left( \begin{array}{c} f_{1} \\ f_{2} \\ f_{3} \\ f_{4} \\ \end{array} \right) % &= % \left( \begin{array}{r} 9 \\ 6 \\ 8 \\ 190 \\ \end{array} \right) % = \left( \begin{array}{r} 9 \text{ parts Al} \\ 6 \text{ parts Si} \\ 8 \text{ parts C } \\ 190 \text{ parts Fe} \\ \end{array} \right) % \end{align} % $$


Solution

$$ % \begin{align} % f &= \mathbf{A}^{-1} p \\ % &= \frac{1}{500} \left( \begin{array}{rrrr} 607 & -393 & -493 & 7 \\ -255 & 245 & 245 & -5 \\ -403 & 97 & 497 & -3 \\ 56 & 56 & -244 & 6 \\ \end{array} \right) % \left( \begin{array}{r} 9 \\ 6 \\ 8 \\ 190 \\ \end{array} \right) \\ % &= \frac{1}{500} \left( \begin{array}{r} 491 \\ 185 \\ 361 \\ 28 \\ \end{array} \right) % \end{align} % $$