Question

i need the answer to be on a MatLab window

1. Consider the following equation, which represents the concentration (c, in mg/ml) of a drug in the bloodstream over time (t, in seconds). Assume we are interested in a concentration of c2 mg/ml C3te-0.4t A. Estimate the times at which the concentration is 2 mg/ml using a graphical method Be sure to show your plot(s). Hint: There are 2 real solutions B. Use MATLAB to apply the secant method (e.g. secant.m) to find each of the solutions/roots with a tolerance of 1 x 10-3 on the absolute relative approximate error C. Calculate the first two iterations of the secant method by hand for starting values of t 0 and t2 seconds. D. Either by hand or by writing a MATLAB function, compute 3 iterations of the bisection method to find the solution/root within the starting interval of [4.5, 5.5] seconds. For each iteration, show the 3 relevant values of t and the corresponding values of f (t) Use the symbolic solve function to find a root of the equation. Express the result as a double (double-precision floating point value) Use the function fzero with suitable starting values to find both of the solutions/roots E. F.

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

A)

PLEASE REFER BELOW CODE

close all
clear all
clc


%given expression
%A)
t = 0:0.1:2; %taking range of t from 0 to 2 with increment of 0.1
c = 3 . t . exp(-0.4 * t); %given expression

plot(t,c);
title('t vs c');
xlabel('time(t)');
ylabel('concentration(c)');

index = find((c-2) <= 0.00);
fprintf('Number of times concentration is 2 mg/ml = %d\n', length(index));

PLEASE REFER BELOW OUTPUT

Number of times concentration is 2 mg/ml = 10
>>t vs c 2.5 2 는 1.5 0.5 0 0 0.2 04 0.6 0.1 1.2 14 1.6 18 2

B) PLEASE REFER BELOW CODE:

close all
clear all
clc

%2) Secant method

%a=input('Input expression : ','s');
%f=inline(a);
f = @(t) ( 3 t exp(-0.4 * t))
%at t = 0;
t(1)= 3 0 exp(-0.4 * 0);

%at t = 2;
t(2)=3 2 exp(-0.4 * 2);

n = 10^-3;
iteration=0;

for i=3:1000
t(i) = t(i-1) - (f(t(i-1)))*((t(i-1) - t(i-2)) ./(f(t(i-1)) - f(t(i-2))));
iteration=iteration+1;
if abs((t(i)-t(i-1))./t(i)) < n
root=t(i)
iteration=iteration
break
end
end


f =

function_handle with value:

@(t)(3*t*exp(-0.4*t))

>>

.....................................................................THE END.......................................................................

Add a comment
Know the answer?
Add Answer to:
i need the answer to be on a MatLab window 1. Consider the following equation, which...
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
  • 1. This question concerns finding the roots of the scalar non-linear function f(x) = r2-1-sinx (1...

    1. This question concerns finding the roots of the scalar non-linear function f(x) = r2-1-sinx (1 mark) (b) Apply two iterations of the bisection method to f(x) 0 to find the positive root. (3 marks) (c) Apply two iterations of the Newton-Raphson method to find the positive root. Choose (3 marks) (d) Use the Newton-Raphson method and Matlab to find the positive root to 15 significant (3 marks) (a) Use Matlab to obtain a graph of the function that shows...

  • In MATLAB please Consider the nonlinear function: y = f(x) = x3 cos x a. Plot...

    In MATLAB please Consider the nonlinear function: y = f(x) = x3 cos x a. Plot y as a function of x as x is varied between -67 and 67. In this plot mark all the locations of x where y = 0. Make sure to get all the roots in this range. You may need to zoom in to some areas of the plot. These locations are some of the roots of the above equation. b. Use the fzero...

  • please show answer in full with explanation, also show matlab 1. Consider the function f(x)2.753 +18r2 21 12 a) Plot...

    please show answer in full with explanation, also show matlab 1. Consider the function f(x)2.753 +18r2 21 12 a) Plot the graph of f(x) in MATLAB and find all the roots of the function f(x) graphically. Provide the code and the plot you obtained. b) Compute by hand the first root of the function with the bisection method, on the interval -1; 0) for a stopping criterion of 1% c) How many iterations on the interval -1, 0 are needed...

  • using Matlab: A drug administered to a patient produces a concentration in the bloodstream given by...

    using Matlab: A drug administered to a patient produces a concentration in the bloodstream given by c(t)=Ate^(-t/3) milligrams per milliliter, t hours after A units have been injected. The maximum safe concentration is 1.00 mg/mL. What amount should be injected to reach this maximum safe concentration, and when does this maximum occur? (Use calculus to find the time when a maximum occurs. Then set c(tmax) = 1 to solve for A.) An additional amount of this drug is to be...

  • question 3 please The first 5 questions refer to finding solutions to the equation exp(w) =...

    question 3 please The first 5 questions refer to finding solutions to the equation exp(w) = 3.8 ln(1+x). You will need to write it in the form f(x)-0, and use various root finding methods. 1. (10 pts) Plot the curves y- exp(Vx), and y 3.8 ln(1+x) on the same graph in the range 0 x 6. Read off intervals in which there are roots of the equation exp(k)- 3.8 In(1+x) Now find the roots to 6 decimal places using the...

  • Questions: 1. Write a MATLAB program to find all the roots of a given, twice continuously differe...

    Questions: 1. Write a MATLAB program to find all the roots of a given, twice continuously differentiable, function f E C2[a, b]. Your program should first probe the function f(x) on the given interval to find out where it changes sign. (Thus, the program has, in addition to f itself, four other input arguments: a, b, the number nprobe of equidistant values between a and b at which f is probed, and a tolerance tol.) For each subinterval [ai,b] over...

  • Write a Matlab function for: 1. Root Finding: Calculate the root of the equation f(x)=x^3 −5x^2...

    Write a Matlab function for: 1. Root Finding: Calculate the root of the equation f(x)=x^3 −5x^2 +3x−7 Calculate the accuracy of the solution to 1 × 10−10. Find the number of iterations required to achieve this accuracy. Compute the root of the equation with the bisection method. Your program should output the following lines: • Bisection Method: Method converged to root X after Y iterations with a relative error of Z.

  • [MATLAB Coding] A four-bar linkage system is shown above. The first link, a, is an input link (crank) of length 1. The second link, b, is a coupler link of length 2. The third link, c, is an output l...

    [MATLAB Coding] A four-bar linkage system is shown above. The first link, a, is an input link (crank) of length 1. The second link, b, is a coupler link of length 2. The third link, c, is an output link of length 4. The forth link, d, is the fixed link (ground) of length 5. All lengths are provided in metres. Please answer the whole question in MATLAB coding. 4 A four-bar linkage system is shown above. The first link,...

  • 13. Write a MATLAB program to find all the roots of a given, twice continuously differentiable,...

    13. Write a MATLAB program to find all the roots of a given, twice continuously differentiable, function f e C2la,b]. on the given interval to find out where it Your program should first probe the function f(x) changes sign. (Thus, the program has, in addition to f itself, four other input arguments: a, b, the number nprobe of equidistant values between a and b at which f is probed, and a tolerance tol.) For each subinterval [a,b;] over which the...

  • DO THIS IN MATLAB PLEASE DO THIS IN MATLAB Create a script file that performs the...

    DO THIS IN MATLAB PLEASE DO THIS IN MATLAB Create a script file that performs the following calculations. Your script will use the functions you create. Label all graphs appropriately. For this project, do not have your homemade functions fprintf anything, instead have all your fprintf commands within your script. Attach your published script file along with .m files for your functions. Exercise 1. A fundamental iterative method for finding the roots of equations of one-variable is known as Newton's...

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