Borrar filtros
Borrar filtros

use x and y in a matrix

10 visualizaciones (últimos 30 días)
Sa Moha
Sa Moha el 16 de Dic. de 2021
Respondida: Steven Lord el 16 de Dic. de 2021
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.

Respuesta aceptada

Steven Lord
Steven Lord el 16 de Dic. de 2021
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 = 

Más respuestas (0)

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by