hello
i wanted to generate a variable B such that
for i=1:10
n1=2;
n2=1:1:10;
B(i)=linspace(n1,n2(i));
end
so my code must generate B such that
B(1)=linspace(2,1)
B(2)=linspace(2,2)
B(3)=linspace(2,3)
and so on
i am unable to do it properly.if anyone can help.
thanks in advance

 채택된 답변

KSSV
KSSV 2020년 4월 9일

0 개 추천

n2=1:1:10;
n1=2;
n = 100 ;
B = zeros(length(n2),n) ;
for i=1:length(n2)
B(i,:)=linspace(n1,n2(i),n);
end

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2020년 4월 9일

댓글:

2020년 4월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by