can anyone help me graph numerical solutions and exact solutions

2 ビュー (過去 30 日間)
Relly Syam
Relly Syam 2021 年 5 月 19 日
コメント済み: Relly Syam 2021 年 5 月 19 日
%
clear;
clc;
format long g
syms c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 t r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10
c0=0; c1=1/10; c2=2/10; c3=3/10; c4=4/10; c5=5/10; c6=6/10; c7=7/10; c8=8/10; c9=9/10; c10=10/10; r0=0; r1=1; r2=2; r3=3; r4=4; r5=5; r6=6; r7=7; r8=8; r9=9; r10=10;
EvalAt = [c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10];
ktemp = arrayfun(@(EA) euler([r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10], EA).', EvalAt, 'uniform', 0);
ptemp=arrayfun(@(EA) int((t-EA)*euler([r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10],t),t,0,EA).', EvalAt, 'uniform', 0);
E = horzcat(ktemp{:}).'
K = horzcat(ptemp{:}).'
Ek=E-K
Inv_Ek= inv(Ek)
F=[1; 1; 1; 1; 1; 1; 1; 1; 1; 1; 1];
C=inv(Ek)*F
%solusi aproximasinya
Ua=@(x)(C(1)*euler(0,x)+C(2)*euler(1,x)+C(3)*euler(2,x)+C(4)*euler(3,x)+C(5)*euler(4,x)+C(6)*euler(5,x)+C(7)*euler(6,x)+C(8)*euler(7,x)+C(9)*euler(8,x)+C(10)*euler(9,x)+C(11)*euler(10,x))
Ue=@(x)(cos(x))
uaa=[];
xx=[];
k=0;
for i=1:11
uaa(i)=Ua(k);
uee(i)=Ue(k);
xx(i)=k;
k=k+.1;
end
Uap= uaa'
Uex= uee'
Err=abs(uaa'-uee')
y=(abs(uaa-uee));
[xx uee uaa y];
uee;
uaa;
y;
plot(xx,uaa,'o',xx,uee,'r')
grid on
plot(xx,y)
grid on
toc
  3 件のコメント
Relly Syam
Relly Syam 2021 年 5 月 19 日
i just found a graph like this, and i think it's just a graph error solution. Could you please help me graph the exact and numerical solutions
Relly Syam
Relly Syam 2021 年 5 月 19 日
I got it now, thank you very much

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

回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by