### ### ### ## ## ## ## ####
##### ## ## ## ## ##
## ### ## ## ## ######
### #### ## ## ## ## ## ## ###### ## #####
_________ \__ __/ ) ( | | | | | | ___) (___ \_______/
IMPORTANT: enter the case-INsensitive alphabetic (no numbers) code AND WRITE SOME SHORT summary of changes (below) if you are saving changes. (not required for previewing changes). Wiki-spamming is not tolerated, will be removed, so it does NOT even show up in history. Spammers go away now. Visit Preferences to set your user name Summary of change: '''Homework assignment''' --- 3 analog inputs from 0 to 5 volts 1 output from 0 - 5 volts ---- 3 inputs defined as i1,i2,i3 1 output defined as o1 notation: i1,i2,i3 => o1 0,4,0.1 => 1.1 0,2,0.1 => 1.2 3,4,0.2 => 3.1 1,4,0.3 => 2.1 many of these contraint: no DAC or microprocessor. Obviously they want an OPA solution. That means inputs are weighted. Weight can be negative, actually 2nd weight is negative and exactly -0.05 =(1.1-1.2)/(4-2) as it's obvious from 1st and 2nd line where input vector just differs in 2nd input variable . I expected to find a linear relationship which is damn easy with OPA-s: <code> octave:1> o=[1.1 , 1.2, 3.1, 2.1]; octave:2> x=[0, 4, 0.1; 0,2,0.1; 3,4,0.2; 1,4,0.3]; check only a 3x3 (upper sub-) matrix so inverse can be calculated: octave:3> o1=[1.1 , 1.2, 3.1]; octave:4> x1=[0, 4, 0.1; 0,2,0.1; 3,4,0.2]; a1=inverse(x1) * o1' a1 = 0.233333 -0.050000 13.000000 quick verification with 3d line: octave:13> 3*0.23333 + 4*-0.05 + 0.2*13 ans = 3.1000 OK. Let's see if 4th line also matches: octave:14> 1*0.23333 + 4*-0.05 + 0.3*13 ans = 3.9333 </code> No luck, 3.9333 != 2.1. ---- The trick is to make an additive offset. '''Step1: find additive offset: output for 0 inputvector''' 0,0,0 => ? This is done by linearly combining the 4 input vectors. I start it for you, by making first number 0: 0,4,0.1 => 1.1 0,2,0.1 => 1.2 From 3d line we subtract 3*(4th line): 3,4,0.2 => 3.1 -3* 1,4,0.3 => 2.1 = 0,-8,-0.7 => -3.2 While from 4th line we subtract 1/3*(3d line): 1,4,0.3 => 2.1 -1/3* 3,4,0.2 => 3.1 = 0,...,... => ... Now our equations are: 0,4,0.1 => 1.1 0,2,0.1 => 1.2 0,-8,-0.7 => -3.2 0,...,... => ... Just continue eliminating 2nd and 3d column to get output for 0 input vector. ---- '''Step2 : subtract the offset from the output''' '''Step3 : calculate the a1 weights''' Same as a1=inverse(x1) * o1' above, that is with matrix inversion. This time you'll see that 4th line will match the weights just fine. Optional: Add document to category: Wiki formatting: * is Bullet list ** Bullet list subentry ... '''Bold''', ---- is horizontal ruler, <code> preformatted text... </code> See wiki editing HELP for tables and other formatting tips and tricks.