Question

I need help for Ex 1-5. Please include the Matlab Coding involved for the problems that...

I need help for Ex 1-5. Please include the Matlab Coding involved for the problems that have to use Matlab

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

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

clear all

f = @(x) sin(x);
e=5*10^-11;
a=3;
b=4;
iter = 0;
tic;
if f(a)*f(b)>=0

disp('No Root')

else

prev = (a+b)/2;
p=a;
while (abs(f(p))>e)
prev=p;

iter =iter+ 1;

p = (a+b)/2;

if f(p) == 0

break;

end

if f(a)*f(p)<0

b = p;

else

a = p;

end
if(iter==100)
disp('the required accuracy is not reached in 50 iterations');
end
end

end
fprintf('pi=%2.10f\n',p);

disp('So, net number of iterations needed are')
disp(iter)
toc;

Note: Brother according to HomeworkLib's policy we are only allowed to answer first question if there are many. So, I request you to post other as separate posts.

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
I need help for Ex 1-5. Please include the Matlab Coding involved for the problems that...
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
  • Need help with coding in MATLAB for communication 1. Use DFT to find the magnitude and...

    Need help with coding in MATLAB for communication 1. Use DFT to find the magnitude and phase spectra of the periodic triangular pulses where has a peak value of 3 at. It is symmetric about with the end points at . The period of is 5. a) Plot for b) Plot the magnitude and phase spectra of.

  • Hi, I need some help writing matlab code for the conversion of a greyscale image to...

    Hi, I need some help writing matlab code for the conversion of a greyscale image to 8-bit per pixel greyscale, using block truncation coding. Can someone please provide some code for me to use?

  • I need help solving these problems using JavaScript coding i want to know the proper codes...

    I need help solving these problems using JavaScript coding i want to know the proper codes for this problem using Javascript Need help solving these two problems Create a pseudocode program that creates a form and asks the user to enter the date in the format mm/dd/yy. Validate the form to ensure the date was entered correctly. Convert the pseudocode in question one to JavaScript and test your program

  • they need matlab code please help i need the code i need picture for the graph...

    they need matlab code please help i need the code i need picture for the graph i need it as soon as possible

  • i need the coding in matlab 1) Numerical Integration There are many simply written functions which...

    i need the coding in matlab 1) Numerical Integration There are many simply written functions which have no simple closed form antiderivative. These functions must, when they arise in physical problems, be integrated numerically. One such function is f(x) = sin(x) a) Find S f(x)dx using the trapezoid rule and 2 sub-intervals b) Repeat part a) with 10 sub-intervals c) Find S, f(x)dx using Simpson's rule and 2 sub-intervals d) Repeat part c) with 10 sub-intervals e) Find S, f(x)dx...

  • This problem needs to be solved using MATLAB! I need help with this homework. I will...

    This problem needs to be solved using MATLAB! I need help with this homework. I will give 100% rating to the answer that is successfully executed and completed. Please provide screenshots of both the MATLAB code and the plots. Problem 4: sketch the signal g(t) = t2 and find the exponential Fourier series to represent g(t) over the interval [-1,1] (Find Dn' s). Plot Dn for n = -20:20. (use stem function in MATLAB and provide your code as well)...

  • PLEASE HELP! I need to write a MATLAB code for this Euler approximation for finding the...

    PLEASE HELP! I need to write a MATLAB code for this Euler approximation for finding the velocity of a parachutist at given time iterations. The answers are provided so you can check to see if the code works. I need to see it done in actual MATLAB program so I can understand the coding methodology better. 1.) Euler Method (estimated time 11min) For the second-order drag model (see Eq. (1)), compute the velocity of a free-falling parachutist using Euler's method...

  • I need help solving these 2 problems using JavaScript coding 1. A sales agent is paid...

    I need help solving these 2 problems using JavaScript coding 1. A sales agent is paid commission on sales. If she sells 200 products per month, she receives a commission of 10%. If she sells more than 200 products but less than 350, she receives a commission of 15 %. If she sells more than 350 products per month, she receives a commission of 20%. Using pseudocode, create an algorithm for the sales agent. Develop a JavaScript program based on...

  • Please help. i need to do each number in a new coding box and i need...

    Please help. i need to do each number in a new coding box and i need to explain each step 1. Find the index of "lmno" in the English alphabet using an appropriate instruction and store it in a variable. (hint: you'll need to define a string that contains the letters of the alphabet in their proper order) 2. Find the length of "lmno" using an appropriate instruction and store it in a different variable. 3. Use those two variables...

  • for part (b) I need to copy MATLAB code.. ex-1 Consider the function f(x) (a) Use...

    for part (b) I need to copy MATLAB code.. ex-1 Consider the function f(x) (a) Use the decimal format with five significant digits (apply rounding) to calculate (using a calculator) fix) for x = 0.005 (b) Use MATLAB (format long to calculate the value of x). Consider this to be the true value, and calculate the true relative error due to rounding in the value of x that was obtained in part (a).

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