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

2 views (last 30 days)
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 Comments
Stephen23
Stephen23 on 19 Dec 2018
Edited: Stephen23 on 19 Dec 2018
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 on 19 Dec 2018
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.

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!