Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Alan

Posts: 151
Registered: 7/24/09
Re: carpet plot
Posted: Mar 9, 2011 3:29 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"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...
>
> http://www.ascgenoa.com/main/newsletter/16/figure_4.jpg
>
> 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))));



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.