Question

In MATLAB write a function that returns the function values and the Jacobian for, x^2 + 9y^2=16 and y - x^2 + 2x = p. Where 0 <= p <= 2.5 The symbolic toolbox can not be used.

In MATLAB write a function that returns the function values and the Jacobian for, x^2 + 9y^2=16 and y - x^2 + 2x = p. Where 0 <= p <= 2.5 The symbolic toolbox can not be used.

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

clear all;
close all;
x1=-3.9999:0.001:3.9999;

y1= (sqrt(16-x1.^2))/9;

J1 = -x1./(9*sqrt(16-x1.^2)); % Jacobian is the partial derivative of
                              % y = f(x) w.r.t x

figure;plot(x1,y1);
xlabel('x ---->');
ylabel('y ---->');
title('x^2 + 9y^2 =16');

figure;plot(x1,J1);
xlabel('x ---->');
ylabel('J ---->');
title('Jacobian of y = (1/9)*sqrt(16-x^2)');

p=0:0.5:2.5;

x2 = -2:0.001:5;
figure;
for i=1:length(p)
    y2 = p(i) - x2.^2 + 2*x2;
    plot(x2,y2);
    hold on;
end
title('y -x^2 + 2x = p');
xlabel('x ---->');
ylabel('y ---->');

Legend=cell(length(p),1);
for i=1:length(p)
   Legend{i}=strcat('p = ', num2str(p(i)));
end
legend(Legend);

J2 = -2*x2 + 2; %Jacobian independent of p
figure;plot(x2,J2)
xlabel('x ---->');
ylabel('J ---->');
title('Jacobian of y = p - x^2+2x');


Add a comment
Know the answer?
Add Answer to:
In MATLAB write a function that returns the function values and the Jacobian for, x^2 + 9y^2=16 and y - x^2 + 2x = p. Where 0 <= p <= 2.5 The symbolic toolbox can not be used.
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
  • Maximize P subject to the given conditions. P = 2x − 9y x ≥ 0 y...

    Maximize P subject to the given conditions. P = 2x − 9y x ≥ 0 y ≤ 3 x − y ≤ 4 maximum value P = point where maximum occurs     (x, y) =

  • 1) a) Write MATLAB function that accepts a positive integer parameter n and returns a vector...

    1) a) Write MATLAB function that accepts a positive integer parameter n and returns a vector containing the values of the integral (A) for n= 1,2,3,..., n. The function must use the relation (B) and the value of y(1). Your function must preallocate the array that it returns. Use for loop when writing your code. b) Write MATLAB script that uses your function to calculate the values of the integral (A) using the recurrence relation (B), y(n) for n=1,2,... 19...

  • Matlab please Using the X and Y values below, write a MATLAB function SECOND_DERIV in MATLAB....

    Matlab please Using the X and Y values below, write a MATLAB function SECOND_DERIV in MATLAB. The output of the function should be the approximate value for the second derivative of the data at x, the input variable of the function Use the forward difference method and interpolate to get your final answer. X=[1,1.2,1.44,1.73,2.07,2.49,2.99,3.58,4.3,5.16,6. 19,7.43,8.92, 10.7,12.84,15.41,18.49]; Y=[18.89,19.25,19.83,20.71,21.96,23.6,25.56,27.52,28.67,27.2,19.38,-2.05,-50.9,-152.82,-354.73,-741.48,-1465.11];

  • Using the X and Y values below, write a MATLAB function SECOND_DERIV in MATLAB. The output...

    Using the X and Y values below, write a MATLAB function SECOND_DERIV in MATLAB. The output of the function should be the approximate value for the second derivative of the data at x, the input variable of the function. Use the forward difference method and interpolate to get your final answer. X=[1,1.2,1.44,1.73,2.07,2.49,2.99,3.58,4.3,5.16,6.19,7.43,8.92,10.7,12.84,15.41,18.49]; Y=[18.89,19.25,19.83,20.71,21.96,23.6,25.56,27.52,28.67,27.2,19.38,-2.05,-50.9,-152.82,-354.73,-741.48,-1465.11];

  • 3. (a) Write a MatLab program that calculates for the function F(x, y) = ln(x + Va,2-y2) The prog...

    3. (a) Write a MatLab program that calculates for the function F(x, y) = ln(x + Va,2-y2) The program should use pretty) to display both the original function and the differentiated result, and also use fprintf() to print a label such as "F(x,y) -" and "dF/dxdy - " in front of both the function and the derivative. Then have your program also print out the derivative again after it uses simplify() on the result (b) Find the Taylor expansion of...

  • Exercise 2.5: Function and exponents 1. Graph the functions a) y = 16 + 2x b)...

    Exercise 2.5: Function and exponents 1. Graph the functions a) y = 16 + 2x b) y = 8 – 2x c) y = 2x +12 (In each case, consider the domain as consisting of nonnegative real numbers only) 5. Condense the following expressions: b) x^a\times x^b\times x^c c){\ \ x}^3\times y^3\times z^3 6. Find: b) \left(x^{1/2}\times x^{1/3}\right)/x^{2/3}

  • matlab help? incorrectQuestion 7 0/0.83 pts Newton-Raphson iteration is to be used to solve the following system of equations: y +1-x3 Calculate the elements of the Jacobian matrix (to 2 decimal...

    matlab help? incorrectQuestion 7 0/0.83 pts Newton-Raphson iteration is to be used to solve the following system of equations: y +1-x3 Calculate the elements of the Jacobian matrix (to 2 decimal places) if the values of x and y in the current iteration are x 1 and y 1.5. Rearrange the equations to formulate the roots problems so that the constants (5 in the first equation and 1 in the second equation) are positive before taking the partial derivatives J.11...

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

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

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