Can anybody help me solving this question with script file?
Afficher commentaires plus anciens
Create a main script (program) that asks the user which expression to show and then draws the appropriate face by calling functions for most of the data. The switch structure can be used as part of this (it can be found in your textbook).
Hint: You will need to use the hold command to plot on one Figure. You must use at least one function in your program, mycircle.
[x y] = mycircle(x_center, y_center, radius)
The mycircle function returns the arrays of x and y values to be plotted. Your main program (script) then does the actual plotting. If you are clever you can modify the mycircle function with extra inputs so that it creates both arcs and circles. Arcs make nice eyebrows and smiling faces.
Any straight lines you need can be generated without using a function but by hard coding the points.
Remember the hold command we used on the tic-tac-toe board in recitation. Your program should show the following expressions:
- Happy
- Surprised
- Asleep
- A different emotion of your choosing
Réponses (1)
Walter Roberson
le 26 Mar 2017
w = input('which expression to show', 's') ;
switch w
case 'stirlings formula' :
draw_stirlings() ;
end
Catégories
En savoir plus sur Animation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!