필터 지우기
필터 지우기

Find definite integrals for the expressions listed as the elements of a matrix

조회 수: 1 (최근 30일)
I have a matrix populated with symbolic expressions in 2 variables. I would like to carry out a definite surface integral of each expression and keep the results in the same matrix format. A dummy code below:
%Clear variables and cmd window
clear;
clc;
%Define symbolic variables
syms x y;
K_unintegrated = syms(zeros(2));
%Populate K_unintegrated matrix with expressions of 2 variables
K_unintegrated(1,1) = x^2;
K_unintegrated(1,2) = x*y;
K_unintegrated(2,1) = y*x;
K_unintegrated(2,2) = y^2;
%Display K_unintegrated matrix
K_unintegrated
%Attempt surface integral of each expression in the matrix (should
%hopefully give a fully numeric matrix)
K=int(int(K_unintegrated,x=0..2),y=0..2)
I get the following error:
Error: File: example.m Line: 20 Column: 27 The expression to the left of the equals sign is not a valid target for an assignment.
The Mathworks site gives the following info:
Find indefinite integrals for the expressions listed as the elements of a matrix: syms x t z alpha = sym('alpha'); int([exp(t), exp(alpha*t)]) The result is: ans = [ exp(t), exp(alpha*t)/alpha]
This is very much what I would like to do, except I want to evaluate the definite integral of each matrix element.
How can I achieve this in the most efficient way possible?

채택된 답변

Walter Roberson
Walter Roberson 2013년 6월 27일
K=int(int(K_unintegrated,x,0,2),y,0,2)
The syntax you found is only within MuPAD

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by