[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to plot surface using scaled axes values, not indexes
From: |
Terry Duell |
Subject: |
How to plot surface using scaled axes values, not indexes |
Date: |
Thu, 11 Apr 2013 12:14:51 +1000 |
User-agent: |
Opera Mail/12.15 (Linux) |
Hello All,
This is a problem that has vexed me for a while now, and something tells
me that it should be simple and straightforward, but I seem to have a
mental block in getting there.
I have data describing a surface profile, or longitudinal section of a
surface. The surface data is elevation values (z) at constant longitudinal
(x) spacing.
The data is read as follows...
fp1 = fopen("fred","r");
[num1 spac1] = fscanf(fp1,"%6f%6f","C"); % number of points, spacing
profile = zeros(2,num1); % set up array
% read
for i = 1:num1
profile(1,i) = (i-1)*spac1; % x values
profile(2,i) = fscanf(fp1,"%f \n","C"); % z values
end
fclose(fp1);
The real surface has width (y) with constant z at each x, for the range of
y.
I want to be able to visualise the surface, pretty much as per the
attached image (surffltk-sm.jpg), but would like to be able to use real
values for the x and y axes, as I has been done for the z axis.
That surface plot was obtained with the following...
n = 10;
y = zeros(n,num1);
for i=1:n
for j =1:num1
y(i,j) = profile(2,j);
end
end
figure
surf(y)
view(30.0,30.0)
The above code snippet is simply a means of getting something viewable,
I'm sure there are much better approaches.
So, what I want to be able to do, is achieve a surface plot as per
example, but with x and y axes values displayed as scaled values, not as
indexes as shown. I.E. x would have values j = j*spac1, and i = i*spac2,
where spac2 is my real world y spacing.
I have lost track of the various schemes that I have tried to achieve
this, so at the risk of being embarrassed by a simple answer, could
someone please set me straight?
Cheers,
--
Regards,
Terry Duell
surffltk-sm.jpg
Description: JPEG image
- How to plot surface using scaled axes values, not indexes,
Terry Duell <=