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

2 vues (au cours des 30 derniers jours)
Dursman Mchabe
Dursman Mchabe le 17 Déc 2018
Commenté : Dursman Mchabe le 19 Déc 2018
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 commentaires
Stephen23
Stephen23 le 19 Déc 2018
Modifié(e) : Stephen23 le 19 Déc 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 le 19 Déc 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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by