Info
この質問は閉じられています。 編集または回答するには再度開いてください。
How do i modify the code when a=0,a=0.1,...,a=0.9,a=1
1 回表示 (過去 30 日間)
古いコメントを表示
I want to calculate the Ps when a=0.1,a=0.2,....,a=0.9,a=1.0 , so i think i should have 11 different Ps number,however,the window always show me 11 same number,it seems that it just calculate 11 times when the "a" is the same number.
How do i modify my code?
a=0:0.1:1
B=[1;2;3;4;5;6]
C=[7;8;9;10;11;12]
gN=1;
for i=1:1:length(a)
f_A=( a(i)*B+(1-a(i))*C)/norm( (a(i)*B+(1-a(i))*C) );
PsB=abs((gN)/(f_A'*f_A));
PsC=abs((gN)/(f_A'*f_A));
if PsB > PsC
Ps(i)=PsB
else
Ps(i)=PsC
end
end
The window show me
Ps =
Columns 1 through 5
1.0000 1.0000 1.0000 1.0000 1.0000
Columns 6 through 10
1.0000 1.0000 1.0000 1.0000 1.0000
Column 11
1.0000
1 件のコメント
Ankit
2019 年 10 月 2 日
it should be the same number
PsB = num/den , your num is 1 and product of f_A'*f_A is also 1.
What i dont understand size of your variable a is 11, B & C is 6.
回答 (0 件)
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!