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...

  • 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 =...

  • java programe Write a program that prompts the user to enter in an integer number representing...

    java programe Write a program that prompts the user to enter in an integer number representing the number of elements in an integer array. Create the array and prompt the user to enter in values for each element using a for loop. When the array is full, display the following: The values in the array on a single line. The array with all of the elements reversed. The values from the array that have even numbered values. The values from...

  • Write a program that prompts the user for positive integers, only stopping when a negative integer...

    Write a program that prompts the user for positive integers, only stopping when a negative integer or zero is given. The program should then print out how many of the positive integers were odd. Example: Enter a positive integer (0 or negative to stop): 9 Enter a positive integer (0 or negative to stop): 4 Enter a positive integer (0 or negative to stop): 7 Enter a positive integer (0 or negative to stop): -3 You entered 2 odd integers....

  • please solve the Program USING MATLAB. do not do #2. write in details for the command...

    please solve the Program USING MATLAB. do not do #2. write in details for the command lines. Make sure the program runs and also completely does what it askes please Write a Matlab program that displays on the screen checkerboard patterns comprising of two alternating_colors to be selected by the user. Your program MUST use as the checkerboard unit pattern a SQUARE INSCRIBED INSIDE A CIRCLE with unit pattern width and checkerboard dimension also to be inputted by the user....

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
ADVERTISEMENT