mesh plot with lines only

Hi,
I'm trying to plot 2 lines using the mesh function,
This is what I hoping to achieve. This example graph has 45 lines.
I don't really know what to do, if I import the data as column vectors like this:
x = load('x.txt.');
y1 = load('y1.txt.');
y2 = load('y2.txt.');
Could somebody advise me what the command would be to plot them using the mesh function.
I've searched online but cannot find an example similar to this. I just need to be pointed in the right direction.
Thank you

답변 (1개)

Daniel Shub
Daniel Shub 2011년 12월 13일

0 개 추천

In the simplest case you have some data
M = 2;
N = 10;
x = 1:N;
y = 1:M;
z = randn(M, N);
and you create a mesh
mesh(x, y, z);
For you, assuming the text files are the correct sizes ...
M = 2;
y = 1:M;
x = load('x.txt');
N = length(x);
z = zeros(M, N);
for ii = 1:M
z(ii, :) = load(['y', num2str(ii), '.txt']);
end
Instead of mesh maybe you want
plot3(x, y'*ones(1, N), z)

댓글 수: 4

John
John 2011년 12월 13일
Hi, thank you for the help,
Something is going wrong though, it might the format of my text files.
This is what I'm getting:
http://img97.imageshack.us/img97/3364/42609519.jpg
The text files have the following format: x is a column vector of time values, with values 0-23 (hrs) y1 is a column vector of velocity, with 24 different values y2 is a column vector of velocity, with 24 different values also
I am hoping to achieve something like this, excuse the artwork!
http://img208.imageshack.us/img208/2156/24614675.jpg
Thank you
John
John 2011년 12월 13일
apologies for miss-posting earlier
Daniel Shub
Daniel Shub 2011년 12월 13일
I edited my question to include a plot3 option. Is that more what you are looking for?
John
John 2011년 12월 14일
many thanks

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

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

태그

질문:

2011년 12월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by