![]() So what we can do is come in here and say I want to make Y into a vector. That isn't going to do very well if we want to plot this data. Now what if we wanted to plot those? Well, every time through this loop we have overwritten the value of Y so we lost, like for instance, 9.528 when we generated 10.857. And we can see we've gone through this loop 10 times and gotten different values of Y. ![]() I'm going to run it by hitting F5, which means save and run the current file. So I want to actually see the results of this. So we're going to just have a random number generated-somewhere between 0 and 1-and add it to the current value of I, and end. Now inside of this loop what we're going to do is say Y is equal to I plus rand. ![]() What we're going to do is say for I is equal 1 : 10, meaning that we're going to count from 1 to 10. In today's video on MATLAB basics, we're going to show how to store the results of a calculation inside of a vector, which is a special case of a matrix.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |