How to put a range of values into an array

조회 수: 194 (최근 30일)
Krystyna Doran
Krystyna Doran 2021년 2월 4일
편집: Krystyna Doran 2021년 2월 4일
So I have a range of values that need to go into an array so I can then add a second range to each element of the array. It's not a range of values I can just manually type out; it's a range of sizes, and then on each value for each size, I need to add on a range of colors. I just have no idea how to do this; I'm completely new to Matlab and have no idea what I'm doing.

채택된 답변

Krystyna Doran
Krystyna Doran 2021년 2월 4일
편집: Krystyna Doran 2021년 2월 4일
I'm answering my own question because this was the solution that worked:
I performed a matrix multiplication between the two ranges of values by transposing the second matrix, then plotted the resuling equation using imagesc.

추가 답변 (1개)

KSSV
KSSV 2021년 2월 4일
Read aboout linspace.
xo = 1 ; x1 = 10 ;
x1 = linspace(x0,x1,500) ; % creates 500 points between 1 and 10
dx = 0.1 ;
x2 = x0:dx:x1 ; % creates elements with a difference of dx
  댓글 수: 2
Krystyna Doran
Krystyna Doran 2021년 2월 4일
Thanks, I'll take a look!
Krystyna Doran
Krystyna Doran 2021년 2월 4일
So say that in this case, dx is also a range? (In this case, wavelengths). Can I define dx as a range, and then apply every value of dx to each individual value made in x1?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by