Azzera filtri
Azzera filtri

use x and y in a matrix

10 visualizzazioni (ultimi 30 giorni)
Sa Moha
Sa Moha il 16 Dic 2021
Risposto: Steven Lord il 16 Dic 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.

Risposta accettata

Steven Lord
Steven Lord il 16 Dic 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 = 

Più risposte (0)

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by