Calling a Specific Function/Equation that is in an Array

조회 수: 6 (최근 30일)
Justin Tennenbaum
Justin Tennenbaum 2020년 4월 29일
답변: David Hill 2020년 4월 29일
I have a set of functions in an array, and need to call specific functions from within an array so that I can graph them. But if I index a specific row of the array, but a function will only allow one expression. Below is an example of what I am trying to do.
A(x)=[x,2x,3x;4x,5x;6x]
B=A(1,:)
Where it should be B=[x,2x,3x]. But this will give me an error. I need to graph the functions in the rows, so I can't just call the values at a specifc x and then take the value after the fact.
Suggestions?

답변 (1개)

David Hill
David Hill 2020년 4월 29일
h_matrix = @(x)(x*[1 2 3;4 5 6]);
A = sym(h_matrix);
B = A(1,:);

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by