필터 지우기
필터 지우기

forward backward and central approximations

조회 수: 3 (최근 30일)
ray sanchez
ray sanchez 2015년 5월 14일
I'm pretty sure I have the code right to plot the graphs for the forward backward an central approximations of a derivative (although I'm not positive). The only thing I need to do now is have it output a value for x=3.2. I'm not quite sure how to do this. Here is my code so far. clear; close all; clc;
delx = 0.05;
x = 0.01:delx:5;
y = 1000.^(x/17);
fig = figure();
set(fig,'color','white');
plot(x,y,'linewidth',2);
xlabel('x');
ylabel('y');
grid on;
yforward = diff(y) ./ delx;
hold on
plot(x(1:end-1)-delx/2,yforward,'r-','linewidth',2);
ybackward = diff(y) ./ delx;
hold on
plot(x(1:end-1)+delx/2,ybackward,'g-','linewidth',2);
ycentral = diff(y) ./ delx;
hold on
plot(x(1:end-1),ycentral,'b-','linewidth',2);
If someone could tell me how to output that value (and also make sure the code is right for the approximations) that would be awesome. Thanks.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Directed Graphs에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by