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 9, 2011 3:29 PM

"Sebastian " <sebastian.meng@meng-muenchen.de> wrote in message <il8jae\$5u9\$1@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...
>
>
> 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))));

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