Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How can I make an array with a function that defines every element?

1 visualización (últimos 30 días)
Lisanne Hogeveen
Lisanne Hogeveen el 5 de Oct. de 2016
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
I would like to make an array theta_i=(theta_1, theta_2, .., theta_n) such that I can define a function theta_j=1/j for all j. So the result would be: theta_i=(1, 1/2, 1/3, ..., 1/n) for some n.

Respuestas (2)

Adam
Adam el 5 de Oct. de 2016
You don't need a function, just
1 ./ theta_i
will do

Pritesh Shah
Pritesh Shah el 5 de Oct. de 2016
for i=1:lenth(theta_i)
y(i)=1/i;
end

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by