필터 지우기
필터 지우기

Hi all nice holiday ?

조회 수: 1 (최근 30일)
ABDULLA RAHIL
ABDULLA RAHIL 2015년 12월 22일
편집: James Tursa 2015년 12월 22일
to generate data between 0.04 and 0.07 using this formula below or nay other formulas, my question i need to put this equation in the loop so i dont want to add the rows and column numbers how can i do that any help is really appreciated r = a + (b-a).*rand(100,1);

채택된 답변

James Tursa
James Tursa 2015년 12월 22일
Is this what you want? It generates the random numbers, then in a loop uses the k'th sample r(k).
a = 0.04;
b = 0.07;
n = 100;
r = a + (b-a).*rand(n,1);
for k=1:n
% Use r(k) here in your code
end
  댓글 수: 3
ABDULLA RAHIL
ABDULLA RAHIL 2015년 12월 22일
편집: James Tursa 2015년 12월 22일
also to make it very clear i will send what i want to do see the loop below
i=1;
for i=1:1:365;
if surpluspower2(i)>=100
p(i)=0.04;
elseif surpluspower2(i)<100 & surpluspower2(i)>0
p(i)= 0.04 + (0.07-0.04).*rand(?????);
else
p(i)=0;
end
end
James Tursa
James Tursa 2015년 12월 22일
편집: James Tursa 2015년 12월 22일
p(i)= 0.04 + (0.07-0.04)*rand; % <-- Use rand without inputs to get scalar result

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Holidays / Seasons에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by