New Reply

matlab: It is confusing

 
Share Thread
Jun19-12, 02:35 PM   #1
 

matlab: It is confusing


When I use matlab to draw contour and color scale map of an array. The result is weird.

my code:
the first:
b=load('c:\...\b.txt');
contour(b)

the second:
b=load('c:\...\b.txt');
image(b)

The results are very different. I upload the array file and two figures.
Attached Thumbnails
ri.jpg   le.jpg  
Attached Files
File Type: zip b.zip (40.2 KB, 1 views)
PhysOrg.com science news on PhysOrg.com

>> City-life changes blackbird personalities, study shows
>> Origins of 'The Hoff' crab revealed (w/ Video)
>> Older males make better fathers: Mature male beetles work harder, care less about female infidelity
Jun20-12, 07:05 AM   #2
 
Quote by nenyan View Post
When I use matlab to draw contour and color scale map of an array. The result is weird.

my code:
the first:
b=load('c:\...\b.txt');
contour(b)

the second:
b=load('c:\...\b.txt');
image(b)

The results are very different. I upload the array file and two figures.
I'm not a Matlab user, so I'm only guessing from the on-line documentation, but it may be that Matlab's image is treating your flat matrix as levels in the range 0-255 (or 63535). In which case, they are all to small to be distinguishable from 0. Try normalizing the data first - I've attached a Mathcad image (zoomed in slightly) to show what I mean (Mathcad converts reals to integers and shows a similar effect, which the function normalize overcomes)
Attached Thumbnails
phys - 12 06 20 matlab image 01.JPG  
Jun20-12, 09:23 AM   #3
 
Quote by NemoReally View Post
I'm not a Matlab user, so I'm only guessing from the on-line documentation, but it may be that Matlab's image is treating your flat matrix as levels in the range 0-255 (or 63535). In which case, they are all to small to be distinguishable from 0. Try normalizing the data first - I've attached a Mathcad image (zoomed in slightly) to show what I mean (Mathcad converts reals to integers and shows a similar effect, which the function normalize overcomes)
Thank you. After nromalization, it is still different.
Attached Thumbnails
ri.jpg   le.jpg  
Jun20-12, 09:26 AM   #4
 

matlab: It is confusing


Oh, I got it. The y axis is reversed.
Jun20-12, 09:54 PM   #5
 
You can use the imagesc() function instead of normalization. It will automatically set the scale range to the range of your data.
New Reply

Similar discussions for: matlab: It is confusing
Thread Forum Replies
Matlab: How to apply filters to and ECG signal using matlab? Math & Science Software 2
Confusing Introductory Physics Homework 3
Confusing myself Introductory Physics Homework 2