필터 지우기
필터 지우기

use x and y in a matrix

조회 수: 10 (최근 30일)
Sa Moha
Sa Moha 2021년 12월 16일
답변: Steven Lord 2021년 12월 16일
I want calculate D(x,y) after running code.
clear;
clc;
syms x y;
E=cell(3,1);
E{1}=[1,1,1;1,2,0;3,5,2];
E{2}=[1,0,0;3,2,1;0,4,3];
E{3}=[0,1,1;0,2,1;2,6,1];
A=[1;5;7];
B=[2,3,4];
C(x)=A+x*B;
D(x,y)=E{y}*C;
D(1,2)
But it returns error. Can someone help please?
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic
variables, and function body must be sym expression.

채택된 답변

Steven Lord
Steven Lord 2021년 12월 16일
syms x y;
E=cell(3,1);
E{1}=[1,1,1;1,2,0;3,5,2];
E{2}=[1,0,0;3,2,1;0,4,3];
E{3}=[0,1,1;0,2,1;2,6,1];
A=[1;5;7];
B=[2,3,4];
C=A+x*B;
D = @(xin,y) subs(E{y}*C, x, xin);
D(1,2)
ans = 

추가 답변 (0개)

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by