Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Solving for the coefficent of linear equations with one known coefficent

Subject: Solving for the coefficent of linear equations with one known coefficent

From: John Wong

Date: 10 Oct, 2012 20:14:08

Message: 1 of 1



clc;
clear all;

syms y a2 a3

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [ 0.5 0.25 0.125 ] [ a2 ] [ y ]
% [ 1 1 1 ] [ a3 ] = [ 3 ]
% [ 2 4 8 ] [ 6 ] [ 2 ]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

M = [0.5 0.25 0.125; 1 1 1; 2 4 8];
t = [a2 a3 6];
r = [y 3 2];

sol = M * t'

s1 = solve(sol(1), a2) % solve for a2
s2 = solve(sol(2), a3) % solve for a3

This is what I have so far. These are my output

sol =

 conj(a2)/2 + conj(a3)/4 + 3/4
       conj(a2) + conj(a3) + 6
  2*conj(a2) + 4*conj(a3) + 48


s1 =

- conj(a3)/2 - 3/2 - Im(a3)*i


s2 =

- conj(a2) - 6 - 2*Im(a2)*i

sol looks like what we would have if we put them back into equation form:

    0.5 * a2 + 0.25 * a3 + 0.125 * a4

    a2 + a3 + a4 = 3

    2*a2 + 4*a3 + 8*a4 = 2

where a4 is known == 6.

My problem is, I am stuck with how to use solve to actually solve these equations to get the values of a2 and a3.

part i. I need to get rid of the imaginary
s2 solve for a3 but it doesn't match what we have on paper (not quite).
a2 + a3 + 6 = 3 should yield a3 = -3 - a2.

I need to equate the vector solution sol to the values [y 3 2] for each row so that imaginary can go away.

part ii.
I may figure out part ii to solve a2 and a3 if part i is solvable.... can anyone provide hints?

Thanks!

Thanks.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us