%% Assign Outputs to Functions or Variables
% When solving for multiple functions, dsolve returns a structure by default. Alternatively, you can assign solutions to functions or variables directly by explicitly specifying the outputs as a vector. dsolve sorts the outputs in alphabetical order using symvar.
% Solve a system of differential equations and assign the outputs to functions.

syms y(t) z(t)
eqns = [diff(y,t)==z, diff(z,t)==-y];
[ySol(t),zSol(t)] = dsolve(eqns)

%
% Copyright 2019 The MathWorks, Inc.