Question

Plot a star that prompts the user to enter how many points the star has. Only worry about odd numbered points. Indicate to th

How do I solve using Matlab?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

n=input('Enter the number of points(Odd only):');
if rem(n,2)==0
disp("Please enter odd number of vertices");
else
xy = linspace(-2*pi, 2*pi, 2*n+1);
radius = 1;
x = radius*cos(xy);
y = radius*sin(xy);
plot( x(1:2:end), y(1:2:end), 'r-' );
axis('equal');
endif

C:\Octave OCTAVE-1.0\mingw64\bin\octave-gui.exe octave:72> n=input(Enter the number of points(Odd only):); Enter the number

Add a comment
Know the answer?
Add Answer to:
How do I solve using Matlab? Plot a star that prompts the user to enter how...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 6) Plot a star that prompts the user to enter how many points the star has....

    6) Plot a star that prompts the user to enter how many points the star has. Only worry about odd numbered points. Indicate to the user only odd numbers can be entered. Change the star line color to red.

  • please solve using python thank you! Write a program which prompts the user to enter a...

    please solve using python thank you! Write a program which prompts the user to enter a number of rows, and prints a hollow square star pattern with 2 diagonals. Note: you can assume that the integer will always be > 1 and will be an odd number. For example: Input Result 5 Enter number of rows: 5 ***** ** ** * * * ** ** ***** 9 Enter number of rows: 9 ** ** ** * * * * *...

  • C++ Write a program that prompts the user to enter integers or a sentinel to stop....

    C++ Write a program that prompts the user to enter integers or a sentinel to stop. The program prints the highest and lowest numbers entered, the sum and the average. DO NOT USE ARRAYS, only variables and loops. Write a program the prompts the user to input a positive integer. Keep asking the user until a positive integer is entered. Once a positive integer is entered, print a message if the integer is prime or not. (NOTE: A number is...

  • Write a script in MATLAB that prompts the user to do a, b, & c. a.)script...

    Write a script in MATLAB that prompts the user to do a, b, & c. a.)script that prompts the user to enter the day of the week using the input function. If the information the user enters is equal to “Saturday” or “Sunday”, display “have a nice weekend” in the Command Window. Otherwise, display “Good luck in your class lectures and your studies.” b.)script that prompts the user to input the following array by providing an example in the prompt:...

  • Using C++ Design a program that Prompts the user to enter in 4 numbers, then have...

    Using C++ Design a program that Prompts the user to enter in 4 numbers, then have the program arrange the numbers entered in Ascending order using "if" statements to complete the task...

  • MATLAB QUESTION 8) Create a program that first prompts the user to enter any two numbers....

    MATLAB QUESTION 8) Create a program that first prompts the user to enter any two numbers. Then prompt the user again to input as many numbers as they choose. Stop the program by inputting-1. Then, display the largest number and second largest number in the command window once the user kills the program. The built-in max function cannot be used. The figure below is an example of what the command window should look like when the code is ran. First...

  • How do I solve using Matlab? Use MATLAB to create a pattern such as the one...

    How do I solve using Matlab? Use MATLAB to create a pattern such as the one below in the command window. Prompt the user to enter the max number of columns and number of intervals ran. In the left figure, the user selected 10 max columns and one interval. In the right figure, the user selected 5 max columns and two intervals. The program should run for n max columns and n number of intervals. **** ***** ***** *****

  • solve this using matlab and post the code on how to solve for it and plot...

    solve this using matlab and post the code on how to solve for it and plot it as well i know the picture is there but i want to learn how to plot it on matlab please - 1/2 The orbit of Pluto is elliptical in shape, with a = 5.9065 x 109 km and b = 5.7208 x 109 km The perimeter of an ellipse can be calculated by P = 401 V1 –k? sin’e ao where k =...

  • MATLAB Programming Question Create an M-file (script) that prompts the user to enter a value of...

    MATLAB Programming Question Create an M-file (script) that prompts the user to enter a value of x and then calculates the value of sin (x). This is my script: x=input('enter value of x in radians'); y=sin(x); And I get the error message, Warning: Function sin has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. How would I fix this?

  • Using Python, write a program that prompts the user to enter their age as an integer...

    Using Python, write a program that prompts the user to enter their age as an integer and then prints out a message that says I suspect you were born in the year xxxx where "xxxx" is the current year minus the age entered. An example run where the user entered 10 for their age, would look like this: Please enter your age as an integer: 10 I suspect you were born in 2009

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT