problema funcion sparse
Publicado por alejandro (6 intervenciones) el 29/05/2017 05:08:47
tengo el siguiente error:
Undefined function 'sparse' for input arguments of type 'sym'.
Error in ejercicioviga (line 59)
Kglobal=sparse(f,c,v,n+1,n+1)+Kglobal;
alguien podria decirme en que estoy mal por fis.
Undefined function 'sparse' for input arguments of type 'sym'.
Error in ejercicioviga (line 59)
Kglobal=sparse(f,c,v,n+1,n+1)+Kglobal;
alguien podria decirme en que estoy mal por fis.
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
clear
clc
syms x real
n=4;
L=4;
l=L/n;
elem=[1 2
2 3
3 4
4 5];
nodo=[1
2
3
4];
gdl=[2*elem(:,1)-1 2*elem(:,1) 2*elem(:,2)-1 2*elem(:,2)];
%%%%%%%%Funciones de forma%%%%%%%%%%%%%
V=[1 x x^2 x^3];
V_d=diff(V,x);
xi=[0 l];
for i=1:2
x=xi(1,i);
eval(V);
eval(V_d);
P(2*i-1,:)=eval(V);
P(2*i,:)=eval(V_d);
end
%p=length(V);
T=[1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1];
M=P\T;
N=V*M;
N1=simplify(N(1,1));
N2=simplify(N(1,2));
N3=simplify(N(1,3));
N4=simplify(N(1,4));
%%%%%%%%%Matriz de rigidez local%%%%%%%%%%%%%%%%%%%%%
syms x real
E=1;
I=1;
klocal=E*I*int(diff(N',2)*diff(N,2),x,0,L);%%%% %N=[N1*N1 N1*N2 N1*N3 N1*N4
% N2*N1 N2*N2 N2*N3 N2*N4
% N3*N1 N3*N2 N3*N3 N3*N4
% N4*N1 N4*N2 N4*N3 N4*N4]
%%%%%%%%%ensamble matriz rigidez global%%%%%%%%%%%%%%
Kglobal=sparse(n+1,n+1);
for i=1:4
for j=1:4
f=[gdl(:,i)];
c=[gdl(:,j)];
v=klocal(i,j);
Kglobal=sparse(f,c,v,n+1,n+1)+Kglobal;
end
end
Full(Kglobal)
Valora esta pregunta


0