Drawing a pentagram in MATLAB
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Write a program that draw a pentagram of user-‐specified size. Specifications: 1) The pentagram is of user-‐specified size. Note the five tips of the pentagram are located on a circle? Your program will prompt the user for the radius of that circle; your program should validate for positive numbers. 2) Use geometry/trigonometry to calculate the x vector and y vector of the tips that are necessary to plot he pentagram. 3) Do not use loops. Instead, use arrays and array math.
0 Kommentare
Antworten (1)
Ismail Ken
am 8 Jan. 2023
Bearbeitet: Image Analyst
am 8 Jan. 2023
plot(fft(eye(5)*-1j),'r');
axis square
2 Kommentare
John D'Errico
am 8 Jan. 2023
Please do not do obvious homework assignments for students. This does not help the student. It teaches them only that they can hope to find someone willing to do the work assigned to them as a student. It hurts the site, because it teaches that student to ask agin, posting all of their homework questions with no effort made. It hurts the site, because now all students will come to believe they too can post their homework here with no effort made.
DGM
am 8 Jan. 2023
Bearbeitet: DGM
am 8 Jan. 2023
I think this example is fair enough, as it does not directly meet the requirements of the assignment, and I think it's clear that the assignment doesn't intend this approach. It's also an 8-year old question, so OP's needs part of the equation anymore. Any new students who are struggling with trig and vectorized operations are probably going to have more trouble unpacking this example than they would solving the problem in the intended manner. Maybe some of them will give it a thought, and that's a good thing.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!