How to add a matrix?? with sym

n=input('How many nodes are there?')
C = sym(zeros(4,4));
D = sym(zeros(n,n));
% x_index = [1 2 5 6];
% y_index = [1 2 5 6];
x_nodes = [3 4 5 6];
y_nodes = [3 4 5 6];
for i = 1:size(C)
for j = 1:size(C)
D(x_nodes(i),y_nodes(j)) = k1(i,j);
end
end
D
C = sym(zeros(4,4));
D = sym(zeros(n,n));
% x_index = [1 2 5 6];
% y_index = [1 2 5 6];
x_nodes = [3 4 5 6];
y_nodes = [3 4 5 6];
for i = 1:size(C)
for j = 1:size(C)
J(x_index(i),y_nodes(j)) = k2(i,j);
end
end
J
C = sym(zeros(4,4));
U = sym(zeros(n,n));
% x_index = [1 2 5 6];
% y_index = [1 2 5 6];
x_nodes = [3 4 5 6];
y_nodes = [3 4 5 6];
for i = 1:size(C)
for j = 1:size(C)
U(x_index(i),y_nodes(j)) = k3(i,j);
end
end
U
sym(Kg)=D+J+U
I cannot get the Kg value..
I dont know why?

Answers (0)

Categories

Find more on Simulation in Help Center and File Exchange

Tags

Asked:

on 1 Jun 2019

Community Treasure Hunt

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

Start Hunting!