Question

Question 4 MATLAB

a) Write a function file called q4.m containing the following nonlinear equations. ?(?1?2 ) = ?1 2 + ?2 2 − 26

?(?1?2 ) = 3?1 2 + 25?2 2 − 100 (1 Mark)

b) Use MATLAB’s FSOLVE operator to solve these equations with x1 = 2 and x2 = 2 as your starting point. How many iterations did MATLAB use to solve them? (1 Mark)

Answer #1

**Answer
4:**

**Part
(a)**

%% Part (a) q4.m file function f = q4(x) f(1) = x(1)^2 + x(2)^2 - 26; f(2) = 3*x(1)^2 + 25*x(2)^2 - 100; end

**Part
(b)**

%% Part (b) % Get the function from q4.m F = @q4; % Given starting points x1 = 2; x2 = 2; % Solve the function [x, fval, exitflag, output] = fsolve(F, [x1, x2]); % Print the solution fprintf("The solution for F is\n"); fprintf("\tx1 = %f\n", x(1)); fprintf("\tx2 = %f\n", x(2)); fprintf("The number of iterations is %d\n", output.iterations);

**Output:**

**Kindly rate the answer and for any help just drop a
comment**

Solve the following system of nonlinear equations:
?(?,?)=?2 +2x+2?2 -26
?(?,?)=2?3 -?2 +4y-19
Use Newton-Raphson method. Carry out the first five
iterations,
startingwith? =1and? =1.

2.
2052
Write a function in MATLAB called HTBALL to
calculate the height of a ball based on a single input, the elapsed
time. The elapsed time will be a single variable in the range of 0
to 6. Predict the value by fitting a 2nd order polynominal to the
data points shown below using the polyfit command.
Use the command polyval to determine the height of
the ball at the inputted time.
timevals=[0,.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6];
height=[0,46,84,114,136,150,156,154,144,126,100,66,24];
Copy and paste the data...

Solve the following problem using the MATLAB environment
Write a function [approx_root, num_its] = bisection(f,a,b,tol)
that implements the bisection method. You function should take as
input 4 arguments with the last argument being optional, i.e, if
the user does not provide the accuracy tol use a default of 1.0e-6
(use varargin to attain this). Your function should output the
approximate root, approx_root and the number of iterations it took
to attain the root, num_its. However, if the user calls the...

Part 2: Solve the following problems in
MATLAB
1. Fill in the function E = myElim(A, r_entry, r_pivot, c) to
create an m by m
elimination matrix ??. Remember that
an elimination matrix looks like an identity matrix with one extra
entry of ?? in row r_entry and column r_pivot.
2. Fill in the function M = myMult(A, c_pivot) to create an m by
m multiplier matrix ??. Remember that a multiplier matrix looks
like an identity matrix with the...

Write a C++ program to demonstrate thread synchronization. Your
main function should first create a file called synch.txt. Then it
will create two separate threads, Thread-A and Thread-B. Both
threads will open synch.txt and write to it. Thread-A will write
the numbers 1 - 26 twenty times in nested for loops then exit. In
other words, print 1 - 26 over and over again on separate lines for
at least 20 times. Thread-B will write the letters A - Z...

Question 2:
Write a C program that read 100 integers from the attached file
(integers.txt) into an array and copy the integers from the array
into a Binary Search Tree (BST). The program prints out the
following:
The number of comparisons made to search for a given integer in the
BST
And
The number of comparisons made to search for the same integer in
the array
Question 3
Run the program developed in Question 2 ten times. The given values...

please write the code in java so it can run on jGRASP import java.util.Scanner;
2 import java.io.*; //This imports input and output (io)
classes that we use
3 //to read and write to files. The * is the
wildcard that will
4 //make all of the io classes available if
I need them
5 //It saves me from having to import each
io class separately.
6 /**
7 This program reads numbers from a file, calculates the
8 mean (average)...

Write a Python 3 program called “parse.py” using the
template for a Python program that we covered in this module.
Note: Use this mod7.txt input file.
Name your output file “output.txt”.
Build your program using a main function and at least
one other function.
Give your input and output file names as command line
arguments.
Your program will read the input file, and will output
the following information to the output file as well as printing it
to the screen:...

Biology Unit I Homework - Nutritional
Analysis Worksheet
Introduction
In Chapters 3 and 4 of the textbook, you learned that the body
needs various macro and micronutrients in order to function
properly. You also learned about cellular metabolism and what the
human body uses as a fuel source. This all seems simple at first
glance; however, it can be difficult to determine whether we are
getting what our body needs. Even when we know what our body needs,
it becomes...

Please provide a brief overview on:
chapter 21
1. Can I obtain the net electric field due to two or
more point charges?
2. Can I obtain the net Coulomb force on a point charge
due to two or more point charges?
3. Can I draw physical quantities (for example,
velocity, forces or electric fields) involved in a given problem in
a diagram?
4. Do I have a good "qualitative" understanding of the
motion of a charged particle in a...

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 3 minutes ago

asked 4 minutes ago

asked 20 minutes ago

asked 32 minutes ago

asked 32 minutes ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago