Run a script 5 times whilst changing the value of one parameter each time.

조회 수: 2 (최근 30일)
Dursman Mchabe
Dursman Mchabe 2018년 12월 17일
댓글: Dursman Mchabe 2018년 12월 19일
Hi everyone
I would like to run the attached script 5 times whilst changing the value of kga from 4e-1 to 4e-2, then 4e-3, then 4e-4, then 4e-5. I would also like to plot the respective results of the repeats on the same set of axis for each respective figure. I would like to ask for help on how to do it.
Regards
Dursman
  댓글 수: 23
Stephen23
Stephen23 2018년 12월 19일
편집: Stephen23 2018년 12월 19일
I wrote mymainfun so that you could input any vector of kga values without hardcoding them, which means that you will need to call the function with those values, e.g.:
tmp = [4e-1, 4e-2, 4e-3, 4e-4, 4e-5];
out = mymainfun(tmp);
If you prefer to have have hardcoded values then just get rid of the input argument and write that vector inside the function:
function out = mymainfun()
vec = [4e-1, 4e-2, 4e-3, 4e-4, 4e-5];
num = numel(vec);
out = cell(1,num);
for k = 1:num
out{k} = Repeat1(vec(k));
end
end
... etc
You are the code's designer, so these things are entirely up to you.
Dursman Mchabe
Dursman Mchabe 2018년 12월 19일
Thank you so so somuch. The code works 100%. I still have a veery long way to go in learning matlab. But I believe that one day I will be good. I will keep on reading, asking and trying. I thank you so so somuch for everythink that I have learnt yesterday and today.

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by