![]() If this doesn't work correctly for you, or you have any questions on the code, feel free to comment. As mu1 and mu2 go from 1 to 100, but in each step you set the value mu, it will have size 1x101. Answers (1) Adriena Welch on 0 Link Edited: Adriena Welch on You may look the package matconv : install.packages ('matconv'). Note that in MATLAB it is better to preallocate all variables. Is there a generic way to convert a MATLAB code into an R-code Thanks. Always keep in mind, that * and / are the matrix multiplication and division in MATLAB. ![]() As the normpdf function allows vectors as inputs, you can dump the inner for loop and use a vectorized approach instead. With that the for loop can easily be adapted. The arguments are the same as in R: normpdf(X,mu,sigma) The MATLAB equivalent of the dnorm function of R is normpdf.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |