How to create a specific vector c that has two variables x and y ?

조회 수: 8 (최근 30일)
CodeElinesa
CodeElinesa 2018년 2월 28일
댓글: Roger Stafford 2018년 2월 28일

the problem here is this vector must be found from c = A\b. A and b are created from two variables x and y. (I posted the image of example xi,yi). x and y come from the normal parabola(ax^2 + bx +c) first, then they could be used in the matrix to form A and b. if my question is too confusing, just see the image...sorry, I am not good at explaining a problem :c Is there a way to solve it ? Thank you.

  댓글 수: 3
CodeElinesa
CodeElinesa 2018년 2월 28일
yh, i know, if the problem just asks me to use the example x,y values to create c vector, that would be simple. The question is, is there a way to represent the A,b matrix so that any x,y variable could be used?
CodeElinesa
CodeElinesa 2018년 2월 28일
편집: CodeElinesa 2018년 2월 28일
at this moment, I create c = parabola(x,y) for further usage Sorry, I forgot to say input vector x and y are only required to be length 3

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

답변 (1개)

Roger Stafford
Roger Stafford 2018년 2월 28일
편집: Stephen23 2018년 2월 28일
Assume your xi's and yi's are given by a couple of column vectors, x and y of the same length.
n = length(x);
A = [x.^(n-1:-1:0)];
c = A\y;
  댓글 수: 2
CodeElinesa
CodeElinesa 2018년 2월 28일
I don't think it makes sense, because you can check my image, A must be 3x3 matrix, and b is 3x1, and what about x^2?
Roger Stafford
Roger Stafford 2018년 2월 28일
If you have an older version of matlab, use
A = bsxfun(@power,x,((n-1):-1:0));
where again I assume x is a column vector.

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

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by