Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Although Calculus is not a prerequisite for this course, in an earlier assignmen

ID: 2082023 • Letter: A

Question

Although Calculus is not a prerequisite for this course, in an earlier assignment you have already started to understand that "the derivative" of a function is its "rate of change." If you think about a simple straight line, the slope of that line is the "the change in y" divided by "the change in x": m = Delta y/Delta x. For a simple straight line, the slope, and therefore "the rate of change of y with respect to x", is constant. For a more general function, (perhaps y = x^2), the slope of the curve is different for different values of x. You can only talk about the value of the slope, (the rate of change of y with respect to x), at a specific point, x_0. In Calculus, instead of calling the rate of change the slope, it is called the derivative of the function. As shown in Eq. 1 using the example of a straight line, a (') or a fraction-notation is used to denote the derivative of a function and either "I", or the symbol for the dependent variable can be used. f(x) = y = mx + b rightarrow f(x)= df/dx = dy/dx = y'(x)= rate of change of y/rate of change of x = Delta y/Delta = m= slope In an earlier assignment, you were required to develop a UDF that computes an approximate value for the derivative of a function at a point x_0 by computing the slope between two nearby points: dfdx|_x_0 = f(x_o + h)-f(x_o - h)/2h; where h = x_o/100 Although formulas that are more accurate exist for computing an approximate value for the derivative of a function, this is the simplest and it is often good enough for engineering purposes. Even if you have yet to start your study of Calculus, you already know some interesting things about the trig-functions: sine, cosine, tangent. For example, the value of the sine function is never less than -1 or more than 1. It looks like a wave that repeats every 2pi radians (360degree). The sine of an angle is dimensionless: it is just a number that has no units! If you have yet to start your study of Calculus, you are about to learn something new about the rate of charge of the sine function, about the derivative of the sine function. Craft a UDF to produce three plots, stacked in a single column, in a single Figure Window, that performs the following tasks. For each plot, the x-axis should be drawn at y = 0 & no borders at top & right edge. 1. Accepts as an input argument a 3 element vector containing a lower bound, an upper bound, and the number of points to be used for the independent variable to produce each plot where the values of the bounds are specified in radians. 2. As the top plot in the stack, plots the value of sin(x) from the lower bound to the upper bound, labeling the y-axis as "sin(x)". [MATLAB's fplot built-in cannot be used because you cannot specify the number of points in the plot.) 3. As the middle plot in the stack, using the same values of x as used to plot sin(x). plots approximate values for the derivative of sin(x) using the method associated with (Eq. 2). labeling the y-axis as 'dfdx(x)'. 4. As the bottom plot in the stack, using the same values of x as used to plot sin(x). plots the value of cos(x). labeling the y-axis as 'cos(x)'.

Explanation / Answer

%sindiff.m

function r = sindiff( low,upp,num )
    x = low:(1/(num-1)):upp;
  
    fx = sin(x);
  
    dfx = diff(fx);
  
    fx2 = cos(x);
  
    figure
  
    subplot(3,1,1);
    plot(x,fx);
  
    subplot(3,1,2);
    plot(dfx);
  
    subplot(3,1,3);
    plot(x,fx2);
  
%UNTITLED4 Summary of this function goes here
%   Detailed explanation goes here


end

%calling file

clc;
close all;
clear all;

sindiff(2,10,20);

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote