-
Notifications
You must be signed in to change notification settings - Fork 5
/
fundop.m
36 lines (31 loc) · 918 Bytes
/
fundop.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
% FUNDOP Computes derivative operators
% USAGE
% [D,Dfspace]=fundop(fspace,order);
%
% To create a function (family definition structure, Dfspace, and coefficient matrix, Dc)
% equal to the derivative of integral of an existing function (fspace and c) use:
% [D,Dfspace]=fundop(fspace,order);
% Dc=D*c;
% Copyright (c) 1997-2002, Paul L. Fackler & Mario J. Miranda
% paul_fackler@ncsu.edu, miranda.4@osu.edu
function [D,Dfspace]=fundop(fspace,order);
if length(order)==1, order=order(ones(fspace.d,1)); end
D=cell(1,fspace.d);
Dfspace=fspace;
for i=1:fspace.d
if order(i)~=0
[d,n,a,b,parms]=feval([fspace.bastype{i} 'dop'],fspace.parms{i}{:},order(i));
D{i}=d{end};
Dfspace.n(i)=n;
Dfspace.a(i)=a;
Dfspace.b(i)=b;
Dfspace.parms{i}=parms;
else
D{i}=speye(fspace.n(i));
end
end
if fspace.d>1
D=ckron(D(fspace.d:-1:1));
else
D=D{1};
end