From the course: Accelerated MATLAB

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Challenge: 3D sinewave and animated parameter shift

Challenge: 3D sinewave and animated parameter shift - MATLAB Tutorial

From the course: Accelerated MATLAB

Challenge: 3D sinewave and animated parameter shift

(catchy music) - [Instructor] The challenge for this chapter will be to create a code to produce a 3D animated sine wave with changing amplitude. This one has two parts. Part one will be static 3D plot of sine wave where you have to plot a 3D sine wave using MATLAB's plot3 function. And then define variables. Create an X vector ranging from zero to four pi by using linspace. Compute y as the sine of x. Define z as a linearly spaced vector from zero to one. And then the third part is customize your plot. Use plot3, x, y, z, with blue color, LineWidth of two to create the plot. Add labels to the X, Y, and Z axes using xlabel, ylabel, and zlabel. Add a descriptive title. Enable grid lines with grid on and adjust the axes with axis tight to ensure a clean visualization. Next, part two will be animated sine wave with amplitude change. Create an animated sine wave. You start with a fresh figure and set up the basic plot with x and ylabels and the title. Then set up an animation loop that…

Contents