below there is a task we were asked to do using matlab. I wrote this function below which works fine. But, since 'for' loops were not shown yet in the course, I think that the instructor meant doing it without loops. Any ideas? Thanks!

By the way, How do I make new line in stackexchange editor? Thanks!

enter image description here Question 2


Given $m$, $n$ you can assign



P.S. Loops in MATLAB are in general slow, substitute it if possible by vector/matrix operations that MATLAB is optimized for.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.