Understanding Matlab Grammar

Asked 1 years ago, Updated 1 years ago, 97 views

I had to read Matlab's sample source code, but I've never done it before and I don't understand a little grammar.

 fort=1:1000
 I = 100*(land(N,1)-0.5);
end;

Could you tell me the meaning of the above code?
I understand what it means to loop 1000 times, but I don't really understand what you're doing to that I.
For those of you who use Matlab regularly, I don't think it's a code, but I appreciate your cooperation.

matlab

2022-09-30 21:22

1 Answers

The comments seem to have been resolved, so I will edit and transfer the answers.

As for the copy from the manual,
"We are generating a vector of N rows and 1 column consisting of uniform distributed real values for the interval (-50, 50)." Random number of uniform distribution - MATLAB land will help you understand.

In other words, the code in the questionnaire extends to (-50.0-50) by subtracting 0.5 from the random number that returns the real number of (0-1.0) and then multiplying it to (-50.0-50) by 100 and substituting it for I as a vector in N rows and columns.


2022-09-30 21:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.