Extract numerical values from a struct
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
xx=5; %No;of nodes in x axis
yy=5; %No;of nodes in y axis
Bv=zeros(xx,yy);
Bv=[23 24 25 26 27
24 0 0 0 28
25 0 0 0 29
26 0 0 0 30
27 28 29 30 31];
Nv=sym('Nv%d%d',[xx-2,yy-2]);
%4 corner voltages
E(1,1)=0.25*(Bv(2,1)+Bv(1,2)+Nv(1,2)+Nv(2,1))==Nv(1,1);
E(xx-2,1)=0.25*(Bv(xx-1,1)+Bv(xx,2)+Nv(xx-2,2)+Nv(xx-3,1))==Nv(xx-2,1);
E(1,yy-2)=0.25*(Bv(1,yy-1)+Bv(2,yy)+Nv(1,yy-3)+Nv(2,yy-2))==Nv(1,yy-2);
E(xx-2,yy-2)=0.25*(Bv(xx-1,yy)+Bv(xx,yy-1)+Nv(xx-3,yy-2)+Nv(xx-2,yy-3))==Nv(xx-2,yy-2);
%edge voltage values
for ii=2:yy-3
E(1,ii)=0.25*(Bv(1,ii+1)+Nv(1,ii-1)+Nv(1,ii+1)+Nv(2,ii))==Nv(1,ii);
end
for ii=2:yy-3
E(xx-2,ii)=0.25*(Bv(xx,ii+1)+Nv(xx-2,ii-1)+Nv(xx-2,ii+1)+Nv(xx-3,ii))==Nv(xx-2,ii);
end
for ii=2:xx-3
E(ii,1)=0.25*(Bv(ii+1,1)+Nv(ii+1,1)+Nv(ii-1,1)+Nv(ii,2))==Nv(ii,1);
end
for ii=2:xx-3
E(ii,yy-2)=0.25*(Bv(ii+1,yy)+Nv(ii-1,yy-2)+Nv(ii+1,yy-2)+Nv(ii,yy-3))==Nv(ii,yy-2);
end
%voltage at inside nodes
for ii=2:xx-3
for jj=2:yy-3
E(ii,jj)=0.25*(Nv(ii,jj-1)+Nv(ii,jj+1)+Nv(ii-1,jj)+Nv(ii+1,jj))== Nv(ii,jj);
end
end
m=solve(E);
m =
Nv11: [1x1 sym]
Nv12: [1x1 sym]
Nv13: [1x1 sym]
Nv21: [1x1 sym]
Nv22: [1x1 sym]
Nv23: [1x1 sym]
Nv31: [1x1 sym]
Nv32: [1x1 sym]
Nv33: [1x1 sym]
Now I want the values of Nv11,Nv12 to be stored in another matrix.since for a generalised code size of matrix Nv will be variying according to user demand,I can not use m.Nv11 to take out the values.Is there any way to store the values of Nv11,Nv12,etc... into other matrix
0 commentaires
Réponses (1)
Voir également
Catégories
En savoir plus sur Assumptions dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!