Question

USE MATLAB Create a code that follows the following criteria for a function of range of...

USE MATLAB Create a code that follows the following criteria for a function of range of -10 to 10.

x ≥ 1 ; f (x) = tan (x)

x < 1 ; f (x) = e x

Afterwards, plot the function

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

x1=-10:0
y1=exp(x1)

plot(x1,y1)

hold on

x2=1:10
y2=tan(x2)

plot(x2,y2)

title('Plot title');
xlabel('X Axis');
ylabel('Y Axis');

print -dpdf graph.pdf

Output:

曰Default Term +Browser 1.55741 -2.18504 -0.14255 1.15782 -3.38052 -0.29101 0.87145 -6.79971 Columns 9 and 10: -0.45232 0.6483

x1 10 9 -8-7 -6 -5 4 3 -2 1 0 yl columns 1 through 6: 4.5400e-051.2341e-04 3.3546e-04 9.1188e-04 2.4788e-03 6.7379e-03 Column

Add a comment
Know the answer?
Add Answer to:
USE MATLAB Create a code that follows the following criteria for a function of range 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
  • i need Matlab code asap Write a program that evaluates the function f(x) = tan’x +...

    i need Matlab code asap Write a program that evaluates the function f(x) = tan’x + x - 2 between -27 and 27 in steps of 1/10 and plots the results. Create a function handle for your function, and use function feval to evaluate your function at the specified points. 2. Write a program that locates the zeros of the function f(x) = cos éx -0.25 between 0 and 27. Use the function fzero to actually locate the zeros of...

  • Please use matlab, post the code, and dont just write the code by hand. Thank you!...

    Please use matlab, post the code, and dont just write the code by hand. Thank you! 4 [3 points] Use the function f(x on the interval [5, 5] and the 11 points below to find a N-10 Lagrange polynomial, using MATLAB. You will need to write code for and plot the polynomial as a function of x, but you do not have to write the polynomials down by hand 5 0 2 3 4 5 f(x) | 0.0399 | 00623...

  • 1) Create a matlab function that calculates: for Name your function TwoVarFunc : The inputs should...

    1) Create a matlab function that calculates: for Name your function TwoVarFunc : The inputs should be in the same order: xmin xmax ymin ymax N: n is the number of elements in the vector x and y The ouputs should be in the same order: f_xy: is the calculated array f(x,y) f_xyMAX: should be the the maximum value of the function f(x,y). Hint: to create vectors x and y look up the matlab built-in function linspace() Hint 2: To...

  • must be python programming. consider function f(x) = sin(x) in the range of 0to pi. create...

    must be python programming. consider function f(x) = sin(x) in the range of 0to pi. create a python code to calculate f’ (derivative of f(x)) in this range and plot these points. calculate the error at all the discrete points. Please do not use Numpy you can use matplotlib

  • MATLAB HELP : Create a MATLAB function starting as follows:- Function [root1,root1] = quadraticroots (a,b,c) to...

    MATLAB HELP : Create a MATLAB function starting as follows:- Function [root1,root1] = quadraticroots (a,b,c) to find the roots of a quadratic function. To test your function find the roots of the following equation:- X^2+5x+6=0 Submit the complete listing and results of a run with the variable a=1,b=5 and c=6. Your file should contain at least the following:- Purpose of the function, Description of the input and output variables, Call statement(s), PLEASE SHOW FULL SCRIPT OF THE MATLAB with results...

  • For the function f(x) = e^(x/2) + 2*x -0.3 Range -2 <xs2 a) Write a Matlab...

    For the function f(x) = e^(x/2) + 2*x -0.3 Range -2 <xs2 a) Write a Matlab program to find the numerical solution of f(x) using the Bisection Method. Important Note: i. Include a copy of your Matlab code in your solution.

  • Create a mathlab code. Create MATLAB/Scilab code that calculates an average and a standard deviation of...

    Create a mathlab code. Create MATLAB/Scilab code that calculates an average and a standard deviation of 8 numbers. Use 2,0,3,0,6,9,4,0 as eight 1 digit numbers to be used for your calculation. Use the following formula for calculating the standard deviation. Use MATLAB function "std"/Scilab function "stdev" to calculate the standard deviation. Compare your result with the result produced by the function. Hypothesize the reason why they are different. (If you do not see a pattern, try different set of numbers...

  • please provide the Matlab code and figure. P2) Use MATLAB to plot the attenuation constant a...

    please provide the Matlab code and figure. P2) Use MATLAB to plot the attenuation constant a in [dB/m] scale as a function of frequency f. Assume er = 10, u = Ho, and o = 4. Notice the variation of loss with frequency. (Enclose the print-out of the plot.)

  • The purpose of this problem is to become familiar with the use of MATLAB. Consider the...

    The purpose of this problem is to become familiar with the use of MATLAB. Consider the continuous-time function x(t) 2e0.5sin(87t)u(t), where u(t) is the unit step function. a) (10 points) Design a MATLAB routine to plot x(t) from t -5 to t = 5 using 10, 100, and 1000 equally spaced samples. The following MATLAB code fragment suggests how this 11. can be done (using 1000 equally spaced samples). Note that the function provided by MATLAB, but can be easily...

  • please solve then upload matlab code Thanks 1. The function f(z, y) (a-x)2 + b(y-12)2 is...

    please solve then upload matlab code Thanks 1. The function f(z, y) (a-x)2 + b(y-12)2 is called Rosenbrock's banana function. It is often used as a benchmarking test for optimization algorithms becatse it is easy to find the minimum by hand but often very difficult to find numerically. Throughout the problem, we will use the values a = 2 and b 10. You can plot this function using the following code: x3:0.1:3; y = -10:0.2:10; Cx,Ymeshgrid(x,y); Z(2-X).2 10* (Y-X. 2)....

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