Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I really need help in solving this matlab program calling hwk1prob1 using the script and I need a lot help in using matlab to solve

image text in transcribed

image text in transcribed

I really need help in solving this matlab program calling hwk1prob1 using the script and I need a lot help in using matlab to solve this problem using matlab. I tried using function with the script hwk1prob1 and I wrote a program that does not work in matlab because I keep getting the same errors such as undefined function,not enough input arguments. It is important in this assignment to create a hwk1prob1.m that does not expect any input, and which determines its own x value to pass as the second parameter to fsolve() .

1. The matlab function fun1.m defines a function f:R2R. Write a matlab program called hwk1prob1.m that uses the matlab function fsolve to solve the equation f(r) 0. Run your program, outputting your solution to the file hwk1out1.txt o Hints/suggestions To get help on using the fsolve function, type "help fsolve" at the matlab command prompt. To use fsolve, you will need to give a starting point x0, which represents an initial guess for the solution. You may need to try multiple starting points to find one that works .A simple way to generate your output file is to type "diary hwk1out1.txt" at the matlab command line and then run your program. function [ y ] -fun1(x) funl (x) evaluates the function f: R*2 - RA2 defined by f (x) - [f1 (x1, x2), f2 (x1, x2)] where f1 (x1, x2)tanh (2x1-3x2+1) f2(x1,x2) = exp (. 3x1+ .4 x2 )-4.7 % input x = vecto r of length 2: x=[x1, x2 ] % output y (fl (x) ,f2 (x)) -tanh (2*x ( 1 )-3*x (2)^2) +1; y(1) y(2) exp ( . 3tx ( 1 ) +.4*x (2))-4.7: end 1. The matlab function fun1.m defines a function f:R2R. Write a matlab program called hwk1prob1.m that uses the matlab function fsolve to solve the equation f(r) 0. Run your program, outputting your solution to the file hwk1out1.txt o Hints/suggestions To get help on using the fsolve function, type "help fsolve" at the matlab command prompt. To use fsolve, you will need to give a starting point x0, which represents an initial guess for the solution. You may need to try multiple starting points to find one that works .A simple way to generate your output file is to type "diary hwk1out1.txt" at the matlab command line and then run your program. function [ y ] -fun1(x) funl (x) evaluates the function f: R*2 - RA2 defined by f (x) - [f1 (x1, x2), f2 (x1, x2)] where f1 (x1, x2)tanh (2x1-3x2+1) f2(x1,x2) = exp (. 3x1+ .4 x2 )-4.7 % input x = vecto r of length 2: x=[x1, x2 ] % output y (fl (x) ,f2 (x)) -tanh (2*x ( 1 )-3*x (2)^2) +1; y(1) y(2) exp ( . 3tx ( 1 ) +.4*x (2))-4.7: end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

25.0 m C B A 52.0 m 65.0 m

Answered: 1 week ago