calling random variables and using them in a loop

4 ビュー (過去 30 日間)
milad babaei
milad babaei 2011 年 6 月 22 日
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?

回答 (1 件)

Razvan
Razvan 2011 年 6 月 23 日
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

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by