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

 채택된 답변

Matt J
Matt J 2014년 3월 26일
편집: Matt J 2014년 3월 26일

0 개 추천

x=(5-c)./(m-2);
y=2*x+5;

댓글 수: 4

Giuseppe
Giuseppe 2014년 3월 26일
편집: Matt J 2014년 3월 26일
This is my for loop.
for gra=m && yint=c
x = (gra-c)./ (m-2)
y = m.*x+c
end
Although I cant get it to work.
Matt J
Matt J 2014년 3월 26일
What's wrong with my original proposal, which doesn't use any loops?
Giuseppe
Giuseppe 2014년 3월 26일
I have a vector with different values for y=2x+5
for i=1:length(gra)
x{i} = (gra(i)- c)./ (m-yint(i));
y{i} = m.*x{i}+c;
end

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

제품

질문:

2014년 3월 26일

댓글:

2014년 3월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by