# Solving unknown matrics to the power 20

85 ビュー (過去 30 日間)
yasmin ismail 2024 年 7 月 10 日

% [P] * [TPM]^n* [R]= CR
disp('Create an array with seven elements in a single row:')
disp('>> P = [1 0 0 0 0 0 0]')
p = [1 0 0 0 0 0 0]
disp('Create an array with seven elements in a single column:')
disp('>> R = [9; 8; 7; 6; 5; 4; 3]')
R = [9; 8; 7; 6; 5; 4; 3]
CR = [0.45]
Solve (TPM)^20=CR/ (p*R)
I would like to find the matrics [TPM] with size 7*7? How to do it ?

サインインしてコメントする。

### 回答 (2 件)

Torsten 2024 年 7 月 10 日

p = [1 0 0 0 0 0 0];
R = [9; 8; 7; 6; 5; 4; 3];
CR = [0.45];
n = 20;
TPM = diag([(CR/(p(1)*R(1)))^(1/n),zeros(1,6)]);
p*TPM^n*R
ans = 0.4500
Hint:
Assume TPM as diagonal: TPM = diag([d(1),...,d(7)]).
p(1)*R(1)*d(1)^n + ... + p(7)*R(7)*d(7)^n = CR
##### 30 件のコメント28 件の古いコメントを表示28 件の古いコメントを非表示
yasmin ismail 2024 年 7 月 15 日 18:28
@Torsten yes i got it
but can you explain to me what does to the power 2 in this equation related to?
obj = @(x)(p*(diag([x;1])+diag(1-x,1))^n*R-CR)^2
Torsten 2024 年 7 月 15 日 18:42

Searching for an x such that f(x) = 0 can be done by minimizing f(x)^2.
Minimizing f(x) doesn't work because "fmincon" would try to make f(x) negative up to -Inf which is not desired.
Instead of f(x)^2, you could take f(x)^n for n being any even integer or any function g(f(x)) where g(y) has its minimum in y=0.

サインインしてコメントする。

Steven Lord 2024 年 7 月 10 日
p = [1 0 0 0 0 0 0];
R = [9; 8; 7; 6; 5; 4; 3];
CR = [0.45];
RHS1 = CR./(p*R)
RHS1 = 0.0500
Did you perhaps mean to take the outer product of p and R, not the inner product? That would give you a right-hand side that is 7-by-7, but ...
RHS2 = CR./(R*p)
RHS2 = 7x7
0.0500 Inf Inf Inf Inf Inf Inf 0.0563 Inf Inf Inf Inf Inf Inf 0.0643 Inf Inf Inf Inf Inf Inf 0.0750 Inf Inf Inf Inf Inf Inf 0.0900 Inf Inf Inf Inf Inf Inf 0.1125 Inf Inf Inf Inf Inf Inf 0.1500 Inf Inf Inf Inf Inf Inf
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
that's basically garbage. You can raise it to the 1/20th power, but GIGO.
RHS2^(1/20)
ans = 7x7
NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Raising RHS1 to the (1/20) power or taking the 20th root gives you something that looks less like garbage, but it isn't 7-by-7.
sol1 = RHS1^(1/20)
sol1 = 0.8609
sol2 = nthroot(RHS1, 20)
sol2 = 0.8609
Check by raising the solutions to the 20th power and comparing with RHS1.
format longg
[sol1^20; sol2^20; RHS1]
ans = 3x1
0.0500000000000001 0.0500000000000001 0.05
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Looks close enough for government work.
What is the actual problem you're trying to solve? I'm guessing this is a homework assignment; if it is show us exactly what you're being instructed to do, not what you think you're being instructed to do.
##### 5 件のコメント3 件の古いコメントを表示3 件の古いコメントを非表示
Steven Lord 2024 年 7 月 10 日
Do you assume that TPM is unique? It's not, no more than the solution to this problem posed by Cleve Moler is unique. That means the second of Cleve's Golden Rules of computation applies: "The next hardest things to compute are things that are not unique."
You've already told Torsten one additional requirement, though it doesn't provide enough information to make the solution unique. "If i want to get in the solution matrix summation of each row =0 or 1?" So what other requirements do you have for this problem?
yasmin ismail 2024 年 7 月 11 日
@Steven Lord I dont what exactly you mean by unique TPM, but what i mean that the condition for my elements will not jump two or three states in one time , they should move one state , if it state 4 shoud move to 3 then 2
and yes the summation for each row in TPM should equal to 1 not zero

サインインしてコメントする。

### カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

### Community Treasure Hunt

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

Start Hunting!

Translated by