필터 지우기
필터 지우기

How Can I put some numbers in a sym and sum its cells?

조회 수: 1 (최근 30일)
masoud jiryaei
masoud jiryaei 2019년 9월 4일
편집: madhan ravi 2019년 9월 4일
I have the matrix [A]= [ a*(x^2)+y , b(y^3)+x ; d*(x^2)*y , c*y ].
and I have the matrix [B]=[1 2;3 4] which the first column of [B] is x and the socond culomn Of [B] is y .
I want to put x=1 and y=2 then x=3 and y=4 and sum A11. then do it for other cells.
  댓글 수: 2
madhan ravi
madhan ravi 2019년 9월 4일
편집: madhan ravi 2019년 9월 4일
Values of c and d??
masoud jiryaei
masoud jiryaei 2019년 9월 4일
a , b,c,d are symbolic variables.

댓글을 달려면 로그인하십시오.

채택된 답변

madhan ravi
madhan ravi 2019년 9월 4일
편집: madhan ravi 2019년 9월 4일
syms a b c d
B = [ 1 2 ; 3 4] ;
x = reshape(B(:,1),1,1,[]);
y = reshape(B(:,2),1,1,[]);
A = [ a*(x.^2)+y , b*(y.^3)+x ; d*(x.^2).*y , c*y ] ;
a = arrayfun(@(z) sum(sum(A(:,:,z))), 1:size(A,3),'un',0);
celldisp(a)

추가 답변 (1개)

KSSV
KSSV 2019년 9월 4일
syms a b c d
B = [ 1 2 ; 3 4] ;
x = B(:,1) ;
y = B(:,2) ;
A = [ a*(x(1)^2)+y(1) , b*(y(1)^3)+x(1) ; d*(x(2)^2)*y(2) , c*y(2) ] ;
iwant = sum(A(:))
  댓글 수: 1
masoud jiryaei
masoud jiryaei 2019년 9월 4일
excuse me you i mean : A11=(a*(1)^2 + 2)+(a*(3)^2 + 4)
A12=...
A21=...
A22=...

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Numbers and Precision에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by