MATLAB for Engineers - Introduction to while Loops (Part 4 of 4): Combining Loops and Logic

preview_player
Показать описание
A while loop is a loop structure for repeating a calculation when the number of loop passes is not known in advance. In this video, we will combine loops and logic by nesting the conditional statement if (if-then) inside of a while loop to determine the maximum height of a projectile. I'll also introduce you to the break command which can be used to terminate a loop early without ending the program. First, I'll introduce you to the problem. Then, we'll walk through a flow chart to demonstrate how the conditional statements dictate the path that the program takes. Finally, we'll solve the problem in the MATLAB programming environment.

If you are unfamiliar with while loops and how they can be used to perform scalar operations, I'd recommend watching Parts 1 and 2 of the series. If you are unfamiliar with working with arrays or array indexing inside of a while loop then I would recommend checking out Part 3. Links to Parts 1 through 3 can be found below.

This is Part 4 of a 4 Part Series on while Loops.

The background music in the intro and outro was written and produced by Michael J Calamas for the exclusive use of David Calamas.
Рекомендации по теме
Комментарии
Автор

Thank you professor you have explained the while loop/for loop perfectly.
I wish you happy days

abu_abd
Автор

you are the master of simplicity, ,,, thank you very much sir ....love from SOUTH AFRICA

siyabulelangongwana
Автор

Wow this While loop series has really helped me, I have been struggling with these in my class

rivers
Автор

Thanks! If you initialize y(i) = 0 and plot the graph or find the maximum height, you get something different. But if you initialize y = 0, you get exactly what you presented, including the maximum height of 51.0 ft

rukundoo
Автор

Woo hooo! 4th vid. Thanks for uploading.

jacobhouston
Автор

Really struggling with the (i) index variable concept. Do you have any videos covering this?

jacobhouston
Автор

Your videos are great. Thank you so much !!

tayyabjawed
Автор

i have a stupid question . y is the gravity 32.2?

peaceandlove-hb