ThrSample1.m ( File view )

  • By 宝马带斗 2013-11-27
  • View(s):186
  • Download(s):6
  • Point(s): 3
			function [f,f0] = ThrSample1 (x,y,y_1, y_N,x0)
syms t;
f = 0.0;
f0 = 0.0;

if(length(x) == length(y))
    n = length(x);
else
    disp('x和y的维数不相等!');
    return;
end                  %维数检查

for i=1:n
    if(x(i)<=x0)&& (x(i+1)>=x0)
        index = i;
        break;
    end
end                          %找到x0所在区间

for i=1:n
    if(x(i)<=x0)&& (x(i+1)>=x0)
        index = i;
        break;
    end
end                          %找到x0所在区间
 
A = diag(2*ones(1,n));       %求解m的系数矩阵
u = zeros(n-2,1);
lamda = zeros(n-1,1);
c = zeros(n,1);
for i=2:n-1
    u(i-1) = (x(i)-x(i-1))/(x(i+1)-x(i-1));
    lamda(i) = (x(i+1)-x(i))/(x(i+1)-x(i-1));
    c(i) = 3*lamda(i)*(y(i)-y(i-1))/(x(i)-x(i-1))+ ...
        3*u(i-1)*(y(i+1)-y(i))/(x(i+1)-x(i));
    A(i, i+1) = u(i-1);
    A(i, i-1) = lamda(i);    %形成系数矩阵及向量c
end
c(1) = 2*y_1;
c(n) = 2
...
...
(Please download the complete source code to view)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 3

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
Atken.m681.00 B24-11-06|22:27
BSample.m988.00 B09-04-08|18:14
DCS.m531.00 B25-11-06|00:51
DH.m1.08 kB09-04-08|18:17
DL.m731.00 B09-04-08|18:15
DTL.m1.66 kB09-04-08|18:16
FCZ.m476.00 B09-04-08|18:15
Gauss.m2.16 kB24-11-06|23:56
Hermite.m661.00 B24-11-06|10:49
Language.m804.00 B24-11-06|22:29
Neville.m616.00 B25-11-06|01:03
Newton.m602.00 B24-11-06|22:39
Newtonback.m725.00 B24-11-06|23:41
Newtonforward.m734.00 B24-11-06|23:25
SecSample.m934.00 B09-04-08|18:12
SubHermite.m844.00 B09-04-08|18:11
ThrSample1.m1.32 kB09-04-08|18:12
ThrSample2.m1.43 kB09-04-08|18:13
ThrSample3.m1.54 kB09-04-08|18:13
...
Sponsored links

ThrSample1.m (9.25 kB)

Need 3 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D