# MATLAB: How to write a vector-valued function with vector input from the screen in MATLAB

function

I am trying to do the following in MATLAB:
`` 1. input *from screen* a small positive integer M (between 1 and 8); 2. input *from screen* M function expressions with variables `t, x1, x2, ... xM`; name for now these M functions f1,f2,...,fM; 3. given a vector `v=[t,x1,x2,...,xM]`, evaluate each of the M functions with the input `v`; 4. the output is a vector `Y=[y1,y2,...,yM]` where `y1=f1(v),y2=f2(v),...`.``
I learned from this [old code] that I can do (1) and (2) with
``     TRUE = 1;     FALSE = 0;     OK = FALSE;     while OK == FALSE     fprintf(1,'Input the number of equations\n');     M = input(' ');        if M <= 0 | M > 7            fprintf(1,'Number must be a positive integer < 8\n');        else            OK = TRUE;        end;     end;     ss = cell(M,1);     for I = 1:M        fprintf(1,'Input the function F_(%d) in terms of t and y1 ... y%d\n', I,M);        fprintf(1,'For example: ''y1-t^2+1'' \n');        kk = input(' ');        ss{I} = kk;     end;``
How can I do (3) and (4)?
``: https://www.mathworks.com/matlabcentral/answers/uploaded_files/97690/ALG057.m``

``TRUE = 1;FALSE = 0;OK = FALSE;while OK == FALSE    fprintf(1,'Input the number of equations\n');    M = input(' ');    if M <= 0 || M > 7        fprintf(1,'Number must be a positive integer < 8\n');    else        OK = TRUE;    endendss = cell(M,1);for I = 1:M    fprintf(1,'Input the function F_(%d) in terms of t and y1 ... y%d\n',...        I,M);    fprintf(1,'For example: ''y1-t^2+1'' \n');    kk = input(' ');    ss{I} = kk;end%(3)V = 1:M+1; %replacing V with other input vectors herec = num2cell(V);Y = zeros(1,M);if M==1    ysym = sym('y1');else    ysym = sym('y%d',[1,M]);endsyms tfor I = 1:M    z = evalin(symengine, ss{I});    f = symfun(z,[t,ysym]);    Y(I)=f(c{:});end%(4)Y``