Sum of a function

조회 수: 2 (최근 30일)
Olawale Kazeem
Olawale Kazeem 2019년 6월 24일
댓글: Himanshu Rai 2019년 6월 25일
Hello everyone, I am stucked on how to write particular code for a Nash-Cournout oligopolistic equilibrium problem. I have written everything correctly and it ran successfully. The only situation I am in presently is trying to vary a particular step. To be more precise
I need code for the following:
is random for every
is random for every and
is random for every . I need to execute the following Quad program $c_j(x_j) = \frac{1}{2}x{_j}^{'} P_j x_j+ {q_j}^{'} x{_j}$. I will be glad if I can get a prompt help on this.
Thanks

채택된 답변

Himanshu Rai
Himanshu Rai 2019년 6월 25일
편집: Himanshu Rai 2019년 6월 25일
The expression below should solve your problem. Also write questions properly - would be scalar, so c is a vector. P and x are normal matrices, and q is a vector. This should solve your problem.
PS - Also update your question, and attach the image file there
c = x' * P * x / 2 + q' * x
  댓글 수: 8
Olawale Kazeem
Olawale Kazeem 2019년 6월 25일
We need q_j to be 1by 3 as well
Himanshu Rai
Himanshu Rai 2019년 6월 25일
Well if is , then can't be calculated, because again the matrices are incompatible

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

추가 답변 (1개)

Olawale Kazeem
Olawale Kazeem 2019년 6월 25일
I just checked the mistake, hopefully I have not disturbed you too much. I am attaching a file that contains what I need.
  댓글 수: 10
Olawale Kazeem
Olawale Kazeem 2019년 6월 25일
I suppose my definition of x is wrong. I defined ; ; and ; . $c = 0.5*x'*P*x+q'*x$. This gives a matrix.
Himanshu Rai
Himanshu Rai 2019년 6월 25일
This is not x, but . is a vector but x is a matrix. And what you denote by c above is actually

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

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by