mardi 17 mars 2020

Problem with equation built with RANDN() function

I have a problem with below program which actually using "randn(); function to update the values by using a for loop. the problem is that the second part of equation ("i mean the equation---> pm(i,1)=pm(i,1)-(pm(i,1)/.005)+(sig*0.005*randn()); " ) which contains the randn() , isn't producing any values , all values in pm matrix are same !! (which shouldn't be) I am in the middle of a project and it needs to be solved very soon , a prompt answer will be of great help.

a=(2*10^-9)/2; %particle diameter
n=1; %time step counter
ttc=0;
f=(6*1.82*10^-5*a);
sig=sqrt(2*1.38*10^-23*300*.005/f);
pm=zeros(30,1);
pm(:,1)=-.005;
% while()
for i=1:30
pm(i,1)=pm(i,1)-(pm(i,1)/.005)+(sig*0.005*randn());
end



Aucun commentaire:

Enregistrer un commentaire