calling random variables and using them in a loop

1 Ansicht (letzte 30 Tage)
milad babaei
milad babaei am 22 Jun. 2011
This function will generate a normal distribution conditional by bounds:
i have used above code 3times and made 3 random variables like c,fi,gamma.now i want to calculate a linear equation like this q= (a*c)+(b*fi)+(k*gamma )....this is my problem :for solving that linear eQu. i need to produce 3 different random variables by above code and use them in a new code to get answer.also q will be a random number because of the nature of those random variables.please let me now if i want to produce 1e4 random number and have 1e4 output of q ,what should i do?

Antworten (1)

Razvan
Razvan am 23 Jun. 2011
I don't understand your question very well... Do you have a system of 10^4 equations and you want to fit the 3 parameters: a, b, and c?
In this case just write your system of equations in matrix form: Q = Coef * X and solve for X: X = Coef \ Q. Here Q is a column vector of the q values, Coef is the matrix with 10^4 rows and on each row it contains the coefficients c, fi and gamma and the result X will give you a column vector with the best fit: a, b, and c
Best, Razvan

Kategorien

Mehr zu Linear Algebra finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by