Info

この質問は閉じられています。 編集または回答するには再度開いてください。

hello professionals plz help me why my code is not showing the value of kp2 and e

2 ビュー (過去 30 日間)
rjnt Kaur
rjnt Kaur 2013 年 4 月 13 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
kp2=rand(10);
e=rand(10);
for i=1:length(50)
r=e(i)*dp-kp1*kp2(i)*(p-1);
if r==1
break;
end
end
Here dp , kp1 and p are previously calculated.in this code value come in fraction and it does not enter the for if loop...plz suggest me code.

回答 (1 件)

Image Analyst
Image Analyst 2013 年 4 月 13 日
length of 50 is 1. So instead of this:
for i=1:length(50)
I think you meant this:
for i=1:50
This runs:
% Make up some scalars for the missing variables.
dp = 1;
kp1 = 1;
p = 10;
% Now run her code.
kp2=rand(10);
e=rand(10);
for i=1:50
r=e(i)*dp-kp1*kp2(i)*(p-1)
if r==1
break;
end
end

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by