# Solving linear equations simultaneoulsy.

2 views (last 30 days)
Giuseppe on 26 Mar 2014
Commented: Matt J on 26 Mar 2014
I have a vector of m and a vector of c values for a set of linear expressions. I have a value for m and c for a single expression. What I want to do is solve the linear equation for all the m and c values. How would I simultaneously solve this expression with every one in the two corresponding vectors.
i.e.
y=2x +5
m=[3 4 5]
c=[2 3 6]
y=2x+5 with y=3x +2
y=2x+5 with y=4x+3
y=2x+5 with y=5x+6
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Accepted Answer

Matt J on 26 Mar 2014
Edited: Matt J on 26 Mar 2014
x=(5-c)./(m-2);
y=2*x+5;
##### 4 CommentsShowHide 3 older comments
Matt J on 26 Mar 2014
for i=1:length(gra)
x{i} = (gra(i)- c)./ (m-yint(i));
y{i} = m.*x{i}+c;
end

Sign in to comment.

### Categories

Find more on Operating on Diagonal Matrices 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!

Translated by