Question

The problem below is a MATLAB question, please do it only Matlab, if you are not...

The problem below is a MATLAB question, please do it only Matlab, if you are not familiar with Matlab or not equipped with the program itself on your computer kindly leave it to someone who is.

Please show me the Matlab codes for these two parts of the problem, I need to put them in same (m.file) so please consider that.

Either you type the code or "preferably" you take a snip of your screen and post to teach me how to do it.

I thank you in advance, and here is the text of the problem ..............................................................................................................................................................................................................

Using no more than 2 lines of code

Write a Matlab function that computes the:

1. FD derivative for the first point

2. BD derivative for the last point

3. CD derivative for all the interior points

for any arbitrary function and any arbitrary X vector and Y vector.

Inputs: x_vector, y_vector (similar to the WS)

output: dydx (a single vector)

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

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

clc
clear all
close all
deriv(0:0.1:1,sin(0:0.1:1))


function dydx=deriv(x_vector,y_vector)
dydx=[(y_vector(2)-y_vector(1))/(x_vector(2)-x_vector(1)) (y_vector(3:end)-y_vector(1:end-2))./(x_vector(3:end)-x_vector(1:end-2)) (y_vector(end)-y_vector(end-1))/(x_vector(end)-x_vector(end-1))]
end

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
The problem below is a MATLAB question, please do it only Matlab, if you are not...
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
  • please do this problem in matlab and show me the code. Thanks. please do this problem...

    please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me the code. Thanks.please do this problem in matlab and show me the code. Thanks. please do this problem in matlab and show me...

  • please do this problem in matlab and show me the code. Thanks. please do this problem...

    please do this problem in matlab and show me the code. Thanks. please do this problem in Matlab and show me the code. Thanks. Problem #1: Circuits and linear-systems In the last HW you developed the governing equations for the “Wheatstone”-bridge circuit used extensively in engineering applications (shown below). B R R2 A D G m RA с E The resulting equations were solved for the output voltage and currents using the function: function [V_out, I_vector] =Wheatstone_bridge (v_in, R_vector) In...

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

  • Please use MatLab and comment code. Problem 2 Write a MATI AB user-defined function y-M?SotxType): x...

    Please use MatLab and comment code. Problem 2 Write a MATI AB user-defined function y-M?SotxType): x is a vector containing numbers. and Type can be 'Ascending' or Descending'. This function should sort the given vector x in the ascending or descending order based on the user's request and return the desired vector as the output. Do not use MATLAB built-in function sort. Hint: When you call this function you need to use for Ascending or Descending since they are strings.

  • please do everything in matlab with commets next to each line of code thank you! %%...

    please do everything in matlab with commets next to each line of code thank you! %% Problem 1 - 1 point % Create a 100-element array, A, which is a random array of integers % Use the randi function for this, 'help randi' %% Problem 2 - 1 point % Use a 'for' loop and an 'if' statement to count how many odd numbers there are in the % array you made in #1 above %% Problem 3 - 1...

  • please answer the question using matlab Problem 3. (you need to include your matLab commands to...

    please answer the question using matlab Problem 3. (you need to include your matLab commands to receive any point, and be sure your answer is valid to at least two decimal places). Use the zooming technique to find solutions of the equation 8- 3sin(x)

  • in MATLAB code/syntax please 3) (Chap 7 problem) Write a function newwords that will receive a...

    in MATLAB code/syntax please 3) (Chap 7 problem) Write a function newwords that will receive a word in a character vector as an input argument. It will then randomly scramble the letters and return the result. Here is an example of calling the function: >> newwords ('exceptional) ans 'tponexlicae

  • Image processing Matlab problem. Could you please help me to write a Matlab code to read...

    Image processing Matlab problem. Could you please help me to write a Matlab code to read images, equalize contrasts, covert images to grayscale and binary, then display on same windows. Then perform SOBEL and CANNY edge detection on images. Final make MATLAB to count the number of circles in images (circles and red circles) And how can we distinguish circles by color? and how to count number of red, green and blue circles separately for example.

  • PLEASE USE MATLAB COMMANDS THANK YOU Use Matlab to graph the functions f(x) = 3xsin(3x) and...

    PLEASE USE MATLAB COMMANDS THANK YOU Use Matlab to graph the functions f(x) = 3xsin(3x) and g(x)= 12 - 2x² so that you can read off the point(s) of intersection (if any), accurate up to two decimal places. 1) Write down the Matlab command(s) you used to create the x-vector. 2) Write down the Matlab command(s) you used to produce the vectors containing the f- and g-function values. 3) Write down the Matlab command(s) you used to plot the graphs....

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

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