i need help on making loop for given equation

조회 수: 4 (최근 30일)
rjnt Kaur
rjnt Kaur 2013년 4월 11일
hello professionals.. I have problem in making loop for given equation ab-cd=1..in this i have to choose random value for a and c but b and d are previously calculated.if value of ab-cd equal to one then display otherwise goes to step where a and c are randomly selected.can u plz help me regarding this..thanks alot

채택된 답변

Ammar
Ammar 2013년 4월 11일
for i = 1:M
a = rand(1);
c = rand(1);
res = a*b - c*d;
if res == 1
disp('')
end
end

추가 답변 (1개)

rjnt Kaur
rjnt Kaur 2013년 4월 12일
Thanks alot for your suggested code..it works..but i forget to write one thing..the actual equation is a*b-c*d*(t-1)=1 where a and c are selected randomly and b,d and t are previously calculated these value should satisfy the above equation until the equation become equal to one and then display the value of a and c...thanks

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by