I want to simulate linear change, can you help me?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi,
I am going to simulate data with linear change. I have already done a simple simulation with only a random error-part like this:
-
function simulation1_values=simulation1(h_error,grand_mean,Nu)
rng('shuffle')
grand_mean=74.3;
Nu=72;
simulation1_values=zeros(Nu,1);
Q=length(simulation1_values);
for r=1:Q
simulation1_values(r)=0;
h_error=randn;
simulation1_values(r)=grand_mean+h_error;
end
end
-
Now I want to include a part that gives a linear change from say 74.3 to 90. Can someone help me? :)
Thank you!
0 Commenti
Risposte (1)
Image Analyst
il 12 Ott 2016
Try linspace
startingValue = 74.3; % Whatever you want.
endingValue = 90; % Whatever you want.
numberOfElements = Q; % Whatever you want.
linearValues = linspace(startingValue, endingValue, numberOfElements);
0 Commenti
Vedere anche
Categorie
Scopri di più su Multicore Processor Targets in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!