Finding a variable value using no fzero etc.

Hi I have another problem that I cannot using fzero or solve or any method that uses initial answers because It can produce the exact answer
Y(t,j)=[0,0,1,0;1,0,0,0;0,0,0,1;0,1,0,0];
A(i,j)=[1,4,6,2;4,5,2,3;5,3,2,4];
now I have K(i,j) which needs to be calculated as follow
sigma(Y(1,j)*(K(1,j)-A(1,j)))=0
this part is simple I could easily calculate K(1,j) after having K(1,j) I need to use it in the following equation to calculate K(t,j)
sigma( sigma(Y(t,j)*(K(1,j)-(sigma(Y(t-1,f)*K(1,f)+A(1,j)))))=0
I calculated the answer K(1,3) = 6 from equation 1
from equation 2 we have K(1,1)=7, K(1,4)=9, K(1,2)=13
it can be easily calculated because it is gradually like this Y(K-A)=0 and we have y that is one and A
The problem is : how can I code the second equation that I would be able to calculate K(t,j) and use it in another equation? no fzero, solve etc. can anyone help?

댓글 수: 1

Matt J
Matt J 2014년 8월 12일
because It can produce the exact answer
Do you mean "can", or did you really mean "can't"? No solver will produce an exact answer. You always have inexact calculations in finite precision computers.

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

답변 (1개)

Matt J
Matt J 2014년 8월 12일

0 개 추천

Your equations are linear, so you just have to build an appropriate matrix equation
P*X=Q
and solve as X=P\Q

댓글 수: 5

alexaa1989
alexaa1989 2014년 8월 13일
yeah thanks that occurred to me too. It is related to linear numerical algebra or something like that but HOW?
Matt J
Matt J 2014년 8월 13일
편집: Matt J 2014년 8월 13일
You have equations of the form
sigma_j Pij *Kj = Qi
This is equivalent to
P*K=Q
where Pij are the entries of the matrix P and Qi are the entries of the vector Q.
alexaa1989
alexaa1989 2014년 8월 13일
that works for first equation second one is much more complicated for me I couldnt write it
Matt J
Matt J 2014년 8월 13일
There shouldn't be a fundamental difference. Both summations are equivalent to weighted sums of the K(i) with different sets of coefficients. Just put the coefficients into the rows of a matrix, one row per equation.
alexaa1989
alexaa1989 2014년 8월 14일
the second summation have another K(1,f) in it
that makes everything different I have been trying to code it for a week now

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

카테고리

도움말 센터File Exchange에서 Optimization에 대해 자세히 알아보기

질문:

2014년 8월 12일

댓글:

2014년 8월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by