Question

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?

0 0
Add a comment Improve this question Transcribed image text
Answer #1
You saved the file as sin.m

As sin is build-in function we should not use it as file name.

So, remove the file names sin.m

Then create a new file named my_sin.m
Then copy below code

x=input('enter value of x in radians');
y=sin(x)

And then run the my_sin.m file

Add a comment
Know the answer?
Add Answer to:
MATLAB Programming Question Create an M-file (script) that prompts the user to enter a value of...
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
  • matlab The Homework should be submitted as a script (.m) file Write a script areaMenu that...

    matlab The Homework should be submitted as a script (.m) file Write a script areaMenu that will print a menu consisting of "Cylinder," "Circle," and "Rectangle." It waits for the user to choose from the menu then call the corresponding function of each choice as follows: 1- Cylinder will call the function (cyl) which prompts the user for the radius and height of the cylinder, then calculates and prints area of the cylinder. 2- Circle will call the function (cir)...

  • Using MATLAB. Create a script file that calls a user-defined function within a for/end loop to...

    Using MATLAB. Create a script file that calls a user-defined function within a for/end loop to symbolically compute the derivative of ln(x) on the interval from -5 to 5, containing 100 data points. Your script file should output a plot of the derivative of ln(x) (taken from your function) vs x. Use a line with circular markers for the plot and include a grid and appropriate labels. The user-defined function should 1. Receive a single x value as input. 2....

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

  • Solve in Matlab by using Script file: Problem 4: Write a user-defined MATLAB unction that calculates...

    Solve in Matlab by using Script file: Problem 4: Write a user-defined MATLAB unction that calculates the determinant of a 3x3 matrix by using the formula: A22 A23 11 A32 A33 A23 A12 A31 A33 21 A For the function name and arguments use d3-det3by3 (A), where the input argument A is the matrix and the output argument d3 is the value of the determinant. Write the code of det3by3 such that it has a subfunction that calculates the 2x2...

  • Create a script file which prompts the user for the water level of the tank pictured below. The t...

    Needs to be solved by a script in MATLAB. Use of if, else, and ifelse statements are encouraged. My main issue is figuring out what order to place if statements in. Please comment if any more info is needed Create a script file which prompts the user for the water level of the tank pictured below. The tank has a cylindrical base with a height of 25 ft and a diameter of 40 ft. The top of the tank is...

  • Create a new MATLAB Script file named MT3P3_itname.m. In your script file perform the following calculations:...

    Create a new MATLAB Script file named MT3P3_itname.m. In your script file perform the following calculations: Prompt the user to enter an integer. Use a multiple if-elseif structure to determine the following: Confirm that the number is an integer. If not, the program displays message 1. Check if the number is divisible by 2 and displays message 2. Check if the number is divisible by 3 and displays message 3. For anything other than 1, 2, or 3, the program...

  • Write a script in matlab that prompts the user to input the day, month, and year;...

    Write a script in matlab that prompts the user to input the day, month, and year; determine the day of the year (the number of days including the current day). Be sure to take leap year into account. Use a for loop Test your code on the following dates: February 28, 2015 April 9, 1976 October 12, 1887 Create a script that performs the same function as repmat. The only built-in commands you may use are input, size, and disp.

  • matlab!!! please help. Problem 4. (worth 15 points) Create a MATLAB function called temperature that prompts...

    matlab!!! please help. Problem 4. (worth 15 points) Create a MATLAB function called temperature that prompts the user to enter body temperature. If the user entered a negative value, send a message to the com telling the user to enter a valid temperature. If the value entered is greater than 98.6 Fahrenheit, send a message to the command window telling the user that he or she has a fever. If the value entered is in between 0 and 98.6 Fahrenheit,...

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

  • Write a script that will create a (random) vector of ages (real numbers, not integers). The...

    Write a script that will create a (random) vector of ages (real numbers, not integers). The script should contain the following prompts: - the user will provide the number of elements in the vector. - the user will provide the age of the oldest person in the group. For example: Enter the number of persons in the group: 50 Enter the age of the oldest person: 37 Save the vector containing the ages in a “.dat file” called ages_vector.dat matlab...

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