A=[-2,1,0,0;1,-2,1,0;0,1,-2,1;0,0,1,-2]
A =
-2 1 0 0
1 -2 1 0
0 1 -2 1
0 0 1 -2
toeplitz([-2,1,0,0,0])
ans =
-2 1 0 0 0
1 -2 1 0 0
0 1 -2 1 0
0 0 1 -2 1
0 0 0 1 -2
toeplitz([-2,1,zeros(1,5)])
ans =
-2 1 0 0 0 0 0
1 -2 1 0 0 0 0
0 1 -2 1 0 0 0
0 0 1 -2 1 0 0
0 0 0 1 -2 1 0
0 0 0 0 1 -2 1
0 0 0 0 0 1 -2
A=toeplitz([-2,1,zeros(1,5)])
A =
-2 1 0 0 0 0 0
1 -2 1 0 0 0 0
0 1 -2 1 0 0 0
0 0 1 -2 1 0 0
0 0 0 1 -2 1 0
0 0 0 0 1 -2 1
0 0 0 0 0 1 -2
sparse(A)
ans =
(1,1) -2
(2,1) 1
(1,2) 1
(2,2) -2
(3,2) 1
(2,3) 1
(3,3) -2
(4,3) 1
(3,4) 1
(4,4) -2
(5,4) 1
(4,5) 1
(5,5) -2
(6,5) 1
(5,6) 1
(6,6) -2
(7,6) 1
(6,7) 1
(7,7) -2
A=toeplitz(sparse([-2,1,zeros(1,5)]))
A =
(1,1) -2
(2,1) 1
(1,2) 1
(2,2) -2
(3,2) 1
(2,3) 1
(3,3) -2
(4,3) 1
(3,4) 1
(4,4) -2
(5,4) 1
(4,5) 1
(5,5) -2
(6,5) 1
(5,6) 1
(6,6) -2
(7,6) 1
(6,7) 1
(7,7) -2
[-2,1,0,0,0]
ans =
-2 1 0 0 0
sparse([1,1],[1,2],[-2,1],1,5)
ans =
(1,1) -2
(1,2) 1
[-20,10,0,0,0]
ans =
-20 10 0 0 0
sparse([1,1],[1,2],[-20,10],1,5)5
??? sparse([1,1],[1,2],[-20,10],1,5)5
|
Error: Unexpected MATLAB expression.
sparse([1,1],[1,2],[-20,10],1,5)
ans =
(1,1) -20
(1,2) 10
toeplitz(sparse([1,1],[1,2],[-2,1]/h^2,1,m)5
??? toeplitz(sparse([1,1],[1,2],[-2,1]/h^2,1,m)5
|
Error: Unexpected MATLAB expression.
toeplitz(sparse([1,1],[1,2],[-2,1]/h^2,1,m)
??? toeplitz(sparse([1,1],[1,2],[-2,1]/h^2,1,m)
|
Error: Expression or statement is
incorrect--possibly unbalanced (, {, or [.
toeplitz(sparse([1,1],[1,2],[-2,1]/h^2,1,m))
??? Undefined function or variable 'h'.
B=[0,1,0,0;-1,0,1,0;0,-1,0,1;0,0,-1,0]
B =
0 1 0 0
-1 0 1 0
0 -1 0 1
0 0 -1 0
toeplitz([0,-1,0,0],[0,1,0,0])
ans =
0 1 0 0
-1 0 1 0
0 -1 0 1
0 0 -1 0
edit
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
catenaria
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
catenaria
catenaria
A
A =
(1,1) Inf
(2,1) Inf
(2,2) -Inf
(3,2) Inf
(2,3) Inf
(3,3) -Inf
(4,3) Inf
(3,4) Inf
(4,4) -Inf
(4,5) Inf
(5,5) Inf
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
catenaria
A
A =
(1,1) 4
(2,1) 4
(2,2) -8
(3,2) 4
(2,3) 4
(3,3) -8
(4,3) 4
(3,4) 4
(4,4) -8
(4,5) 4
(5,5) 4
full(A)
ans =
4 0 0 0 0
4 -8 4 0 0
0 4 -8 4 0
0 0 4 -8 4
0 0 0 0 4
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
catenaria
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
catenaria
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
catenaria
ans =
0.0429
ans =
1.3613e-04
ans =
9.7231e-10
ans =
1.4360e-15
??? Operation terminated by user during ==>
catenaria at 28
catenaria
ans =
0.0484
ans =
0.0074
ans =
0.0010
ans =
2.5993e-04
ans =
6.9696e-05
ans =
6.2561e-06
ans =
3.0495e-06
ans =
6.9173e-07
ans =
1.5804e-07
ans =
1.4014e-08
ans =
8.2575e-09
ans =
2.5512e-09
ans =
4.0815e-10
ans =
9.3468e-11
??? Operation terminated by user during ==>
catenaria at 28
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
catenaria
Warning: Imaginary parts of complex X and/or Y
arguments ignored
> In catenaria at 28
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
catenaria
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
catenaria
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
catenaria
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
catenaria
% Modify expression to add input arguments.
% Example:
% a = [1 2 3; 4 5 6];
% foo(a);
catenaria
catenaria
diary off