Question

The function ? ? can be determined from the function (1 + ?)? ? by right...

The function ? ? can be determined from the function (1 + ?)? ? by right division (1 + ?)? ? /(1 + ?).

(5 pts) Write a function MyExp.m that takes in any array ? and returns its exponent ? ? by using the function OnePxExp() and the right division by (1 + ?).

Use the function in:

(a) (2 pts) the command window to calculate ? −5 and ? 3 . Use a tolerance of 1E-12 in OnePxExp(). Compare your output of MyExp() and the built-in exp() in format long.

(b)(8 pts) a script file HW07P3. m to make plots of the function ? = sin 2? ? 0.2? and its 1st derivative ? ′ with −3 ≤ ? ≤ 6. Your script must do the following:

i. Close all opened figure window if any

ii. Create the variable −3 ≤ ? ≤ 6 with 100 constant linear spacing elements

iii. Determine ?(?) and ? ′ (?), using the function MyExp() and the built-in sin() functions with elementwise operations,

iv. Use one plot command to plot the 2 line graphs in one plot with the same axes. Use different line style and color for each line (DO NOT USE MARKERS) with a linewidth of 1. Label your axis and add a title, legend and grid lines to your plot,

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

%since OnePxExp is not provided, i cant show the outcome. If any error occurs, please provide that file

%Function file

function y = MyExp(x)
y=OnePxExp(x,1E-12)./(1+x);

%script

%a
format long
MyExp(-5)
exp(-5)
MyExp(3)
exp(3)

format

%b
close all
t=linspace(-3,6,100);
y=sin(2*t).*MyExp(.2*t);
dy=2*cos(2*x).*MyExp(x/5) + (sin(2*x).*MyExp(x/5))/5;
plot(t,y,':r','LineWidth',1,t,dy,'--g','LineWidth',1)
xlabel('t')
ylabel('y')
title('HW07P3')
legend('y','y''')
grid on

Add a comment
Know the answer?
Add Answer to:
The function ? ? can be determined from the function (1 + ?)? ? by right...
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 help me with this MATLAB programming problem! Im coding iin MATLAB2018 if that makes any d...

    Please help me with this MATLAB programming problem! Im coding iin MATLAB2018 if that makes any difference! The first picture is the question i need to answer. The picture below is used as reference to answer the question. The last picture (below) is the into to the problem, and is used as reference. 1. Use Matlab to create the following single plot with three subplots. All titles, gridlines, and axis labels should be as shown. Arc System Response 15 E...

  • please help me with this MATLAB CODE and explain to me what each line does and...

    please help me with this MATLAB CODE and explain to me what each line does and what is used for? leave your comments as words, not as pictures. ..................................................................................................................................................................... clear all; close all; % For a script file, you better start with clear all and close all                        % However, for a fucntion, you better NOT to start                        % with them %% End of cell mode example %% Plot function t = 0:0.1:5; x1 = sin(2*5*t); x2 = cos(3*7*t);...

  • Please show the code necessary, and explanations on MATLAB. Plotting 11) Plot the function y =...

    Please show the code necessary, and explanations on MATLAB. Plotting 11) Plot the function y = sin(x) from x = 0 to 21. 12) Plot the functions y = x2 z = x2 + 2x + 1 from x = 0 to 2 on the same graph. Scripts: Input and Output 13) Write a script (M-file) to read in a message at the command line using the MATLAB input function and then display the message to the Command Window using...

  • Use an anonymous function instead of a function file that calculates y(x) = sin(2x)( 4x2 +...

    Use an anonymous function instead of a function file that calculates y(x) = sin(2x)( 4x2 + 3 ). Plot it using fplot, x goes from -8 to 8. Use your function to print out the value of y for x = -1.25 and x = 1.25. Deliverables: Script with anonymous function Plot using fplot Command window output Step by Step Instructions: Copy your calling script from Problem 1 Change the name of the function to be LabFcAnonymous (or something similar)...

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

  • 8. Use the method of slack variables, along with the pivot() function given on iLearn (and...

    8. Use the method of slack variables, along with the pivot() function given on iLearn (and demonstrated in lecture), to find the maximum of the objective function /(*1,02) = 21 +382 subject to the following constraints: 0+32 > 2, (1a) +262 36, (16) -31 +32 51, (1c) 31,39 0. (10) Because there are three constraints (not counting the two non-negativity constraints), there should be throe slack variables. Use the pivot() function to find the four vertices of the feasible region....

  • Please show matlab editor and command window B. (4 pts) Use the : operator to create...

    Please show matlab editor and command window B. (4 pts) Use the : operator to create the vectors x [2.5,1.50.5,-0.5,-1.51 and y [0.4,0.8,1.2,1.6,2], then use them in the following expression to compute vector z using element-by-element calculations C. (8 pts) A 70 lb bag of rice is being pulled by applying a force F at an angle θ as shown. The force required to drag the bag is given by: θ μ sin θ + cos θ Where u-0.35 is...

  •    MATLAB SCRIPT PLEASE Matlab MATH 210 in 2020 Homework Assignment 8- Due 3/25, 11:59PM Each...

       MATLAB SCRIPT PLEASE Matlab MATH 210 in 2020 Homework Assignment 8- Due 3/25, 11:59PM Each plot should have its own figure associated with it. In all questions, give the figure a title, and label the acis. Save your matlab script as drill 10.m Do not use the fplot command. 1. Plot the function f(x) = (x + 5)2 for -5 <<<10. Include a plot title, and label both aris. 2. Use the subplot command to make two plots of...

  • use matlab Assignment: 1) Write a function program that implements the 4th Order Runge Kutta Method....

    use matlab Assignment: 1) Write a function program that implements the 4th Order Runge Kutta Method. The program must plot each of the k values for each iteration (one plot per k value), and the approximated solution (approximated solution curve). Use the subplot command. There should be a total of five plots. If a function program found on the internet was used, then please cite the source. Show the original program and then show the program after any modifications. Submission...

  • Radioactive decay occurs when a radioactive isotope ("parent" isotope) gradually transforms into ...

    Radioactive decay occurs when a radioactive isotope ("parent" isotope) gradually transforms into a radiogenic isotope ("daughter" isotope) over time. This process is modeled by the following function: where r is the ratio of parent to daughter atoms, t is time and τΗ is called the halflife. The following table shows several parent-daughter pairs along with their half-lives. Daughter N14 Srs7 Ar4o Pb206 Pb207 Half-Life (years) 5730 48.8 x 109 1.3 x 109 4.6 x 109 0.7 x 10 arent Rbs7...

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