0

The code is:

subplot(1,3,3)
h=surf(ReflMatrix)
set(h, 'edgecolor','none')
colormap winter %Other colourmaps: Winter,Cool
hold on;
ylabel('frequency (Hz)');
xlabel('angle of incidence (degrees)'); 
alpha(.5) %transparency

The ReflMatrix is 401x90. The values of y range from 0 to 90, which is good because y is angle measured in degrees . The values of x (frequency) range from 0 to 401 because my bandwidth is 401 frequencies but I would like the same graph with values ranging from 300 to 700 (instead of starting from frequency 0 to start from frequency 300).

Ourania
  • 29
  • 5

1 Answers1

0

In surf you can specify your x and y. In your case, define your frequency by

y = linspace(300,700,401);

and the phase by

x = linspace(0,90,91); 

Are you sure with the size of ReflMatrix, since frequencies from 0 to 90 are 91 points rather than 90. Then set your x and y parameters according to

[X,Y] = meshgrid(x,y);
h = surf(X,Y,ReflMatrix);

EDIT:

You can set the limits of the axes accordingly by

xlim([0 90]);
ylim([300 700]);
zlim([min(min(ReflMatrix)) max(max(ReflMatrix))]);
Nemesis
  • 2,324
  • 13
  • 23
  • Thanks very much . It did work. You were right with the 91 points too . I am having one more problem. It now starts at about 340 and ends at about 740, although I did what you said above. Before it started at about 40 and ended at about 440. Why is that? Any clue? – Ourania Nov 03 '14 at 08:23
  • That is indeed strange. What is the output when typing `xlim` and `ylim` once the figure is created? You can query the actual limits of your axes. – Nemesis Nov 03 '14 at 08:32
  • Output is [0,100] for xlim and [200,800] for ylim – Ourania Nov 03 '14 at 08:46
  • Well, just try to set the values to your desired range. `xlim([0 90]); ylim([300 700]);`. Does look okay now? – Nemesis Nov 03 '14 at 08:50
  • Sad I cant upload a photo. I tried this. The labeling changes. Now the origin is (0,300) as it should be and the last value of the y axis is 700. Though, the surface plot still starts at about 340 and it finishes out of the limits of y axis at about 740 – Ourania Nov 03 '14 at 08:58
  • Is it now simply due to your view angle. Try `view(0,90)`. – Nemesis Nov 03 '14 at 09:09
  • Still doesn't seem right to my eyes but that was apparently the problem! I am going to rotate it a bit. Thank you for your answers! – Ourania Nov 03 '14 at 09:17
  • Would be good to access your data (`ReflMatrix`) to test what is actually happening. Maybe you can put it on Dropbox for a minute or so. – Nemesis Nov 03 '14 at 09:19
  • The matrix https://www.dropbox.com/s/pey8171mzr5gur2/matb.mat?dl=0 and the graph https://www.dropbox.com/s/5446pe0x1j24zdx/ABC.png?dl=0 . I just want to bring up the xy surface a bit and I think it will look ok after all. – Ourania Nov 03 '14 at 09:39
  • Perfect! helped a lot – Ourania Nov 03 '14 at 10:47