Question
Need help please!
Question 1: you must use if /else statement to receive credit for this question Write a MATLAB script to prompt the user to e
0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

1)

clc
clear all
t=input('Enter t: ');
if(t>=0&t<5)
f=2*t;
elseif(t==0.5)
f=0;
elseif(t>0.5&t<1)
f=2*t-2;
else
f=4*t;
end
disp('f(t) is ');
disp(f)


MATLAB R2014a EDITOR Find Files Compare Print Comment New Open Save Breakpoints Run Run and Advance Advance Run and Indent El

Note: Brother according to HomeworkLib's policy we are only allowed to answer first question if there are many. So, I request you to post other question as separate posts.

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Need help please! Question 1: you must use if /else statement to receive credit for this...
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
  • Please answer 1c, use MATLAB, and paste your entire script in your answer so that I...

    Please answer 1c, use MATLAB, and paste your entire script in your answer so that I can copy and paste to see if it works. Problem #1 400g triangle square pentagon hexagon Figure 1 For a closed geometric figure composed of straight lines (Figure 1), the interior angles in the figure must add to (n-2)(180) where n is the number of sides. Required Tasks a) Write a script that prompts the user to select from one of the following shapes:...

  • Programming Assignment #2 EE 2372 MAKE SURE TO FOLLOW INSTRUCTIONS CAREFULLY, IF YOU HAVE ANY DOUBTS...

    Programming Assignment #2 EE 2372 MAKE SURE TO FOLLOW INSTRUCTIONS CAREFULLY, IF YOU HAVE ANY DOUBTS PLEASE EMAIL ME! This programming assignment will just be a small extension to programming assignment 1. In the first assignment each of the functions could only take a predefined number of inputs. This time the objective is to be able to complete these functions with any amount of inputs. The user will pass arguments through the command line (this means you will have to...

  • In this lab you will code a simple calculator. It need not be anything overly fancy,...

    In this lab you will code a simple calculator. It need not be anything overly fancy, but it is up to you to take it as far as you want. You will be creating this program in three small sections. You have the menu, the performance of the basic arithmetic operations (Addition, Subtraction Multiplication, and Division), and the looping. You may want to get the switch menu working first, and then fill in the code for these four arithmetic operations...

  • I need help please... Intro to Programming in C – small program 8 Project objective: To...

    I need help please... Intro to Programming in C – small program 8 Project objective: To compile, build, and execute an interactive program using character arrays and string.h functions **Submit source code (prog8.c) through Canvas • One source code file (unformatted text) will be submitted • The file name must match the assignment • The code should be tested and run on a Microsoft compiler before it is uploaded onto Canvas • The code must be submitted on time in...

  • C++ must use header files and implementation files as separate files. I’ll need a header file,...

    C++ must use header files and implementation files as separate files. I’ll need a header file, implementation file and the main program file at a minimum. Compress these files into one compressed file. Make sure you have adequate documentation. We like to manipulate some matrix operations. Design and implement a class named matrixMagic that can store a matrix of any size. 1. Overload the addition, subtraction, and multiplication operations. 2. Overload the extraction (>>) and insertion (<<) operators to read...

  • The assignment In this assignment you will take the Matrix addition and subtraction code and modify...

    The assignment In this assignment you will take the Matrix addition and subtraction code and modify it to utilize the following 1. Looping user input with menus in an AskUserinput function a. User decides which operation to use (add, subtract) on MatrixA and MatrixB b. User decides what scalar to multiply MatrixC by c. User can complete more than one operation or cancel. Please select the matrix operation 1- Matrix Addition A+ B 2-Matrix Subtraction A-B 3Scalar Multiplication sC 4-Cancel...

  • Using matlab and if/else statement please! Write a function that determines the real roots of a...

    Using matlab and if/else statement please! Write a function that determines the real roots of a quadratic equation ax2 + bx + c = 0. To calculate the roots of the equation, the function calculates the discriminant D, given by: D = b2-4ac If D> 0, the code should display "The equation has two roots" and print the values on a new line. If D 0, the code should display "The equation has one root.", and print the value on...

  • Creating a Calculator Program

    Design a calculator program that will add, subtract, multiply, or divide two numbers input by a user.Your program should contain the following:-The main menu of your program is to continue to prompt the user for an arithmetic choice until the user enters a sentinel value to quit the calculatorprogram.-When the user chooses an arithmetic operation (i.e. addition) the operation is to continue to be performed (i.e. prompting the user for each number, displayingthe result, prompting the user to add two...

  • For this assignment, you will write a program that guesses a number chosen by your user....

    For this assignment, you will write a program that guesses a number chosen by your user. Your program will prompt the user to pick a number from 1 to 10. The program asks the user yes or no questions, and the guesses the user’s number. When the program starts up, it outputs a prompt asking the user to guess a number from 1 to 10. It then proceeds to ask a series of questions requiring a yes or no answer....

  • I need help with number 6, 8 and 9. Use the HW8 script. Get a random...

    I need help with number 6, 8 and 9. Use the HW8 script. Get a random sample of n=29 from the data set. Print out the html output (after knitting). You need the output to receive credit. Make sure the set.seed code with your student ID is visible. Perform the calculations by hand for each question using the data generated with the HW8 script. You must show your work here or on a separate piece of paper. Circle the answer...

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