Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: carpet plot
Replies: 5   Last Post: Mar 10, 2011 10:57 AM

 Messages: [ Previous | Next ]
 Alan Posts: 151 Registered: 7/24/09
Re: carpet plot
Posted: Mar 10, 2011 10:57 AM

"Sebastian " <sebastian.meng@meng-muenchen.de> wrote in message <il8rvr\$37g\$1@fred.mathworks.com>...
> TideMan <mulgor@gmail.com> wrote in message <1127f76f-627f-45f8-905a-8d094eff6597@o21g2000prh.googlegroups.com>...
> > On Mar 10, 9:38 am, "Sebastian " <sebastian.m...@meng-muenchen.de>
> > wrote:

> > > "Alan B" <monguin61...@OVETHIS.yahoo.com> wrote in message <il8nuf\$92...@fred.mathworks.com>...
> > > > "Sebastian " <sebastian.m...@meng-muenchen.de> wrote in message <il8jae\$5u...@fred.mathworks.com>...
> > > > > Hey guys,
> > >
> > > > > I have been trying to make a so called carpet plot. Apparently no one knows what it is so have a look at the following link...
> > >
> > >
> > > > > also here is the program I made so far... hope that helps to understand the issue I have.
> > >
> > > > > a=0.3:-0.15:-0.3;
> > > > > b=0.3:-0.15:-0.3;
> > > > > for ia=1:length(a)
> > > > >     for ib=1:length(b)
> > > > >          vf1(ia,ib) = sqrt(3/(-(5/3).*a(ia)+b(ib)+2.*sqrt((a(ia)/3).*((4/3).*a(ia)-b(ib)))));
> > > > >          vf2(ia,ib) = sqrt(3/(-(5/3).*a(ia)+b(ib)-2.*sqrt((a(ia)/3).*((4/3).*a(ia)-b(ib)))));
> > > > >     end
> > > > > end
> > > > > format('longEng')
> > > > > vf1
> > > > > vf2

> > >
> > > > > [X,Y]=meshgrid(0.3:-0.15:-0.3);
> > >
> > > > > so basically i get a matrix called vf1 and vf2. I then need to plot a so called carpet plot for both vf1 and vf2 on separate diagrams. a should be on the y axis and b on the x axis. now vf1 is then plotted for each combination of a and b. There suppose to be 5 vertical lines represented by the variation of b and 5 horizontal lines represented by the variation of a. I hope the link above helps.
> > >
> > > > > I think a good start is using meshgrid for the axis...
> > >
> > > > > Thanks in advance
> > >
> > > > > Seb
> > >
> > > > You can plot your data like this:
> > > > plot(vf1,vf2,'g',vf1',vf2','b')

> > >
> > > > But there is some problem with your domain or your transformation - some of your vf values are complex, or significantly larger than the others
> > >
> > > > Also, you can avoid those for loops:
> > > > [a b] = meshgrid(.3:-.15:-.3);
> > > > vf1 = sqrt(3./(-(5/3).*a+b+2.*sqrt((a/3).*((4/3).*a-b))));
> > > > vf2 = sqrt(3./(-(5/3).*a+b-2.*sqrt((a/3).*((4/3).*a-b))));

> > >
> > > Hey,
> > >
> > > thanks for your reply but that desnt look right :(
> > >
> > > i wish i could upload a picture to show you how it looks like since i have an example in front of me.
> > >
> > > any ideas?

> >
> > You don't seem to be able to describe what you want, and the link you
> > gave earlier was not helpful - it looked like an x-t phase plane with
> > characteristics, i.e., the solution of a hyperbolic PDE.
> >
> > What have you tried?
> > What is wrong with:
> > mesh(a,b,vf1)
> > or
> > surf(a,b,vf1)
> > or
> > contourf(a,b,vf1)
> >
> > Please try each of these and tell us why they do not do what you want.

>
> Ok , sorry to keep on bothering you. Mesh and surface will not work since it is complex. Contour does work however the graph doesn't look at all how it suppose to be. I tried to use the real part of the complex numbers only but the graphs all look wrong
>
> Maybe this helps. Below is a quite unusual looking coordinate system. The intersections of the lines are the values of the matrix vf1. Taking the values a = -0.15 and b = 0.15 the value of vf1 can then be seen at the intersection of those 2 lines. In reality the lines are curved. I do not know how to explain it in other words.
>
> Thank you for your help!
>
> y
> | b
> | -0.3 -0.15 0 0.15 0.3
> | | | | | |
> |--------------------------------------------- 0.3
> | | | | | |
> |--------------------------------------------- 0.15
> | | | | | |
> |--------------------------------------------- 0 a
> | | | | | |
> |--------------------------------------------- -0.15
> | | | | | |
> |--------------------------------------------- -0.3
> | | | | | |
> |------------------------------------------------------->x

Run this:

[a b] = meshgrid(.3:-.15:-.3);
vf = [a(:) b(:)]*randn(2);
vf1 = reshape(vf(:,1),size(a));
vf2 = reshape(vf(:,2),size(a));
clf,
plot(vf1,vf2,'k.'), hold on
plot(vf1,vf2,'g')
plot(vf1',vf2','b')
text(vf1(:,1),vf2(:,1),num2str(vf1(:,1)),'color','b')
text(vf1(1,:),vf2(1,:),num2str(vf2(:,2)),'color','g')

To me, this looks essentially identical, in character, to your linked example. If I am wrong, try to explain, in depth, why it is not what you want. If I am right, then there may be something wrong with either your (a,b) domain, or your transformation from (a,b) to (vf1,vf2). For example, how are you expecting to plot pairs of complex values (four real values) as points in a 2D plane (two real coordinates)?

Date Subject Author
3/9/11 Sebastian
3/9/11 Alan
3/9/11 Sebastian
3/9/11 Derek Goring
3/9/11 Sebastian
3/10/11 Alan