Question

Write a Matlab script to complete the following:1. Write a script file that allows a user to: a. Plot a function from a list b. Change the function coefficients c. Choose fu

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

clc
clear all
close all
disp('1) A*sin(Bx+C)+D');
disp('2) A*sin^2(Bx+C)+D');
disp('3) Ax^3+Bx^2+Cx+D');
disp('4) A*ln(Bx+C)+D');
disp('5) A*exp(Bx+C)+D');
ch=input('Choose one from list: ');
A=input('Enter A: ');
B=input('Enter B: ');
C=input('Enter C: ');
D=input('Enter D: ');
r=input('Enter range as vector: ');
num=input('Enter number of points: ');
x=linspace(r(1),r(2),num);
y(:,1)=A*sin(B*x+C)+D;
y(:,2)=A*(sin(B*x+C).^2)+D;
y(:,3)= A*x.^3+B*x.^2+C*x+D;
y(:,4)=A*log(B*x+C)+D;
y(:,5)=A*exp(B*x+C)+D;
plot(x,y(:,ch),'b');
disp('1) A*sin(Bx+C)+D');
disp('2) A*sin^2(Bx+C)+D');
disp('3) Ax^3+Bx^2+Cx+D');
disp('4) A*ln(Bx+C)+D');
disp('5) A*exp(Bx+C)+D');
ch1=input('Choose one from list to add onto the graph: ');
plot(x,y(:,ch),'b',x,y(:,ch1),'r');
hold off;

disp('1) A*sin(Bx+C)+D');
disp('2) A*sin^2(Bx+C)+D');
disp('3) Ax^3+Bx^2+Cx+D');
disp('4) A*ln(Bx+C)+D');
disp('5) A*exp(Bx+C)+D');
ch=input('Choose one from list to overwrite onto the original graph: ');
plot(x,y(:,ch),'b',x,y(:,ch1),'r');

Figure 1 Eile Edit Yew Insert 1ools Desktop 岦indow Help x 10 18 16 12 10 O Type here to search IN 02/17/19

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
Write a Matlab script to complete the following: 1. Write a script file that allows a...
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 USE MATLAB. THANK YOU! Consider the following polynomial equation: ax3 bx2 cx d 0 Write a program that allows th...

    PLEASE USE MATLAB. THANK YOU! Consider the following polynomial equation: ax3 bx2 cx d 0 Write a program that allows the user to enter the coefficients a,b,c and d and the search range needed for the Bisection method. The program should stop when the maximum error is less than 0.01. The program should display the root and also have a condition to stop when no roots are found in the range. Consider the following polynomial equation: ax3 bx2 cx d...

  • problem2, the file "Test_Data.xlsx" contains in cylinder pressure data from a firing engine. the data is...

    problem2, the file "Test_Data.xlsx" contains in cylinder pressure data from a firing engine. the data is resolved in crank angle degree and is taken every 1/2 degree. O tittps/ualearn blackboard.com/bbcswebdav/pid plot a new function on the same graph overwriting the orizinal function 1 of11ρ Functions to choose from: y A sin(Bx C)+ D y A sin2(Bx+ C) + D y A In(Bx + C)D y A exp(Bx + C)+ D ž. The file "Test Data.xlsx" contains in-cylinder pressure data from...

  • Write a MATLAB script file that will find the values of X and Y required to...

    Write a MATLAB script file that will find the values of X and Y required to minimize the function f(x,y) = 30x + 60y + 40pi*y subject the constraining function g(x,y) = 2xy + (pi*y^2)/2 - 1600 using the method of the Lagrange Optimization Technique.

  • using matlab 3. Write a script that will read the ages vector.dat file created in the...

    using matlab 3. Write a script that will read the ages vector.dat file created in the previous problem. - the script will print the number of persons in the group - the script will print the maximum and minimum ages in the group - the script will compute and print the "average age" The script should return something like: The file contains the ages of a group of 50 people The maximum and minimum ages in the group are 10...

  • Please write the script for following problem in MATLAB. Write a script with a file name...

    Please write the script for following problem in MATLAB. Write a script with a file name Problem3.m that, when executed, prints 1.99 dollars per unit. How many units will you purchase? [new line] Then control is given back to the user to input a scalar integer quantity. The script then prints out __ units at 1.99 dollars per unit is a total of ___ dollars. [new line] where the first blank is filled with whatever number was inputted by the...

  • Write a MATLAB script that loads and displays each of the captured images. Publish the MATLAB...

    Write a MATLAB script that loads and displays each of the captured images. Publish the MATLAB script output as a .docx file. For compactness purposes, show all five waveforms for each case on the same figure using MATLAB subplots. Use the legend function in MATLAB to add appropriate labeling to the subplots to ensure that the Figure legend can be written succinctly.

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

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

  • Problem 1: Use MATLAB to create a script file and publish a pdf file for the...

    Problem 1: Use MATLAB to create a script file and publish a pdf file for the problem: For x equal to 1.5 at intervals of 0.05 y = 6.25 +1.8 Create a rectangular plot of x&y. Submit the published pdf file. Problem 2: Use MATLAB to create a script file and publish a pdf file for the problem: Create a bar chart for Grade А B Students 48 37 29 2 6 D F Submit the published pdf file. Problem...

  • MATLAB Question: Write a script for the problem pictured. Please send the script, not just the...

    MATLAB Question: Write a script for the problem pictured. Please send the script, not just the printout. Make sure your script allows you to input a value for n so when prompted, in the command window, user types n value. The n value should be the f_k if k ==1 .... Please also send print outs if you can. BELOW IS A SAMPLE ANSWER THAT DID NOT PUT THE INPUT SCRIPT NEEDED FOR THIS QUESTION TO BE CORRECT. YOU CAN...

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