loop for equation a*b-c*d*(p-1)=1
2 次查看(过去 30 天)
显示 更早的评论
I need matlab loop code for equation a*b-c*d*(p-1)=1 where a nad c are randomly selected and b,d and p are calculated previously...loop must satisfy the equation and then display a and c
1 个评论
Walter Roberson
2013-4-12
duplicates http://www.mathworks.co.uk/matlabcentral/answers/71707-need-help-on-equation-a-b-c-d-t-1-1
Discussion should happen there.
采纳的回答
Yao Li
2013-4-12
b=1;
d=2;
p=3;
c=rand(10);
for i=1:length(c)
a(i)=1+c(i)*d*(p-1)/b;
fprintf('a=%d c=%d\n',a(i),c(i))
end
2 个评论
Walter Roberson
2013-4-12
This does not randomly select "a"... but randomly selecting both "a" and "c" is unlikely to ever find a solution. See discussion in the original of this thread http://www.mathworks.co.uk/matlabcentral/answers/71707-need-help-on-equation-a-b-c-d-t-1-1
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!