필터 지우기
필터 지우기

Info

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

Can't put all values from a for loop to a vector

조회 수: 1 (최근 30일)
IOANNIS KORACHAIS
IOANNIS KORACHAIS 2020년 11월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
I want to put all the values from x that come out from the loop but it only lets me put 2 values. What am i doing wrong?
function [x,y]= mems(k)
x0 = 0;
x = x0;
for i = 1:
x1 = x;
y1 = 0.3 .* x1;
x(i) = 1 + y1 - 1.4 .* x1 .^ 2;
end
end

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 11월 15일
Are you trying to do something like this?
x = mems(5)
function [x]= mems(k)
x0 = 0;
x = x0;
for i = 1:k
x1 = x(i);
y1 = 0.3 .* x1;
x(i+1) = 1 + y1 - 1.4 .* x1 .^ 2;
end
end

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by