Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

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

조회 수: 1 (최근 30일)
Lisanne Hogeveen
Lisanne Hogeveen 2016년 10월 5일
마감: MATLAB Answer Bot 2021년 8월 20일
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.

답변 (2개)

Adam
Adam 2016년 10월 5일
You don't need a function, just
1 ./ theta_i
will do

Pritesh Shah
Pritesh Shah 2016년 10월 5일
for i=1:lenth(theta_i)
y(i)=1/i;
end

Community Treasure Hunt

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

Start Hunting!

Translated by