필터 지우기
필터 지우기

The dimension of the input vector in the imagesc function

조회 수: 1 (최근 30일)
sun
sun 2020년 5월 1일
댓글: Bjorn Gustavsson 2020년 5월 3일
I used the sample data in the attachment and got the result of Figure 1 when using the imagesc function, but I expected the result to be Figure 2.
(Note: XData, YData, and C in the imagesc () function correspond to the first, second, and third columns in the sample data, respectively.)
I want to ask how the dimensions of the matrix should be adjusted to be similar to the result in Figure 2. Thank you.
figure1
figure 2
  댓글 수: 4
Geoff Hayes
Geoff Hayes 2020년 5월 1일
So the colours we see in the second image represent the speed at that coordinate?
sun
sun 2020년 5월 2일
편집: sun 2020년 5월 2일
We can call it a similar name like velocity field.

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

채택된 답변

Bjorn Gustavsson
Bjorn Gustavsson 2020년 5월 2일
For this type of scattered data you can use scatter, something like this:
scatter(data(:,1),data(:,2),23,data(:,3),'filled')
or if you want to reinterpolate to a regular grid you can use any of griddata, TriScatteredInterp, or scatteredInterpolant.
HTH
  댓글 수: 2
sun
sun 2020년 5월 2일
@Bjorn Gustavsson
The figure below is the result based on the code you said. I have a question whether I can adjust the color, because it seems to have only one color.
Bjorn Gustavsson
Bjorn Gustavsson 2020년 5월 3일
You can adjust the intensity-levels for scatterplots with
caxis([min_level max_level])
where you chose your intensity-range to display.
Sometimes it is also preferable to plot the data in log-scale, you can do that with scatter too - provided your data is positive, just change
scatter(data(:,1),data(:,2),23,data(:,3),'filled')
to
scatter(data(:,1),data(:,2),23,log10(data(:,3)),'filled')
further you might want to dots with smaller (or larger) radius, just change 23 to whatever gives the best display. Sometimes it is worthwhile to sort the points in increasing order. This makes the dots with largest value of data(:,3) to be plotted last which reduces how much they are shaded by other points. To do that use the second out-argument from sort to generate index-vectors.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by