Drawing a pentagram in MATLAB
19 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Ismail Ken
2023 年 1 月 8 日
編集済み: Image Analyst
2023 年 1 月 8 日
plot(fft(eye(5)*-1j),'r');
axis square
2 件のコメント
John D'Errico
2023 年 1 月 8 日
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
2023 年 1 月 8 日
編集済み: DGM
2023 年 1 月 8 日
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.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!