Putting different outputs in one vector matrix

1 vue (au cours des 30 derniers jours)
Hassanean
Hassanean le 17 Mar 2017
Commenté : Hassanean le 17 Mar 2017
Hi Please could anyone have information about how can collect the many separate outputs in the one matrix where these outputs are results from running one equation for several times in matlab.
For example:
x= (1 2 3 4 5 6 7 8 9 ...............)
y=sinx-cosx
y1=? % for first value of x
y2=?? % for second value of x
.
.
.
.
y=????? % for last value of x
Required: collect all these output in one vector matrix [y1; y2; ....;yn]
regards,

Réponse acceptée

James Tursa
James Tursa le 17 Mar 2017
Is this what you want?
x = 1:9; % a vector with elements 1, 2, ..., 9
y = sin(x) - cos(x); % the vector result at each point of x

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by