trying to integrate and differentiate a graph

2 ビュー (過去 30 日間)
Fatima Noneed
Fatima Noneed 2021 年 3 月 16 日
コメント済み: KSSV 2021 年 3 月 16 日
so this is the code that plots my graph
clc
clear
syms t
corner=[-2 0 ;-1 1;1 1;3 4;4 2;7 0;8 0];
%plot(corner);
x=[-3 ;-1; 1; 3; 4;8];
y=[0 ,1 , -2, 4, 2,0];
figure
plot(x,y)
however cant seem to find a code that helps me integrate or differentiate the graph and plot the result as well please help

回答 (1 件)

KSSV
KSSV 2021 年 3 月 16 日
clear
corner=[-2 0 ;-1 1;1 1;3 4;4 2;7 0;8 0];
%plot(corner);
x=[-3 ;-1; 1; 3; 4;8];
y=[0 ,1 , -2, 4, 2,0];
% diffrentiate
dx = diff(x) ;
dy = diff(y') ;
dydx = [0 ;dy./dx] ;
figure
plot(x,y)
hold on
plot(x,dxdy) ;
  6 件のコメント
Fatima Noneed
Fatima Noneed 2021 年 3 月 16 日
n=trapz(x,y)
Figure Plot(n)
KSSV
KSSV 2021 年 3 月 16 日
Good.....you should note that the integration value n gives you area under the curve so it will be a value i.e. a single number. How you can plot it?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by