Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
pde toolbox

Subject: pde toolbox

From: Sashankh Rao

Date: 14 Mar, 2013 18:41:06

Message: 1 of 3

Hi,

I create a geometry using the pde toolbox GUI. I then export the decomposed geometry matrix g into the command space. Now I try to use the
[p,e,t] = initmesh(g) and it works fine.

However, if I copy the same g matrix from the command space to an .m file and try to use initmesh I receive the following error:
-----------------------------------------------------
??? Error using ==> pdevoron at 32
Geometry error.

Error in ==> initmesh at 208
[p,t,c,h]=pdevoron(p,t,[],h,x,y,tol,Hmax,Hgrad);

Error in ==> mhp at 63
[p,e,t] = initmesh(g);
-----------------------------------------------------
I examined my geometry and found that there was a gap. Theoretically the two points must overlap since they are the same. Is this a visualization problem or is there really a gap in my boundary? How can I close this gap? Why does it work in the command space but not when I use the matrix in a .m file. Thanks. Below is my geometry matrix:

g =[

    2 2 2 2 2 2 2 4
    1 0 0.2242 0.7154 0 0.0950 0.4698 1
    1 0.2242 0.7154 1 0.0950 0.4698 0.8447 0.8447
    0 0 0 0 0 0.0950 0.4698 0.4698
    0.4698 0 0 0 0.0950 0.4698 0.8447 0.8447
    1 1 1 1 0 0 0 1
    0 0 0 0 1 1 1 0
    0 0 0 0 0 0 0 0.4698
    0 0 0 0 0 0 0 0.4698
    0 0 0 0 0 0 0 0.5302
    0 0 0 0 0 0 0 0.5302
    0 0 0 0 0 0 0 0
         ];

Thanks,
- Sai

Subject: pde toolbox

From: Bill Greene

Date: 15 Mar, 2013 12:40:07

Message: 2 of 3

"Sashankh Rao" wrote in message <kht5k2$l97$1@newscl01ah.mathworks.com>...
> Hi,
>
> I create a geometry using the pde toolbox GUI. I then export the decomposed geometry matrix g into the command space. Now I try to use the
> [p,e,t] = initmesh(g) and it works fine.
>
> However, if I copy the same g matrix from the command space to an .m file and try to use initmesh I receive the following error:
> -----------------------------------------------------
> ??? Error using ==> pdevoron at 32
> Geometry error.
>
> Error in ==> initmesh at 208
> [p,t,c,h]=pdevoron(p,t,[],h,x,y,tol,Hmax,Hgrad);
>
> Error in ==> mhp at 63
> [p,e,t] = initmesh(g);
> -----------------------------------------------------
> I examined my geometry and found that there was a gap. Theoretically the two points must overlap since they are the same. Is this a visualization problem or is there really a gap in my boundary? How can I close this gap? Why does it work in the command space but not when I use the matrix in a .m file. Thanks. Below is my geometry matrix:
>
> g =[
>
> 2 2 2 2 2 2 2 4
> 1 0 0.2242 0.7154 0 0.0950 0.4698 1
> 1 0.2242 0.7154 1 0.0950 0.4698 0.8447 0.8447
> 0 0 0 0 0 0.0950 0.4698 0.4698
> 0.4698 0 0 0 0.0950 0.4698 0.8447 0.8447
> 1 1 1 1 0 0 0 1
> 0 0 0 0 1 1 1 0
> 0 0 0 0 0 0 0 0.4698
> 0 0 0 0 0 0 0 0.4698
> 0 0 0 0 0 0 0 0.5302
> 0 0 0 0 0 0 0 0.5302
> 0 0 0 0 0 0 0 0
> ];
>
> Thanks,
> - Sai


Hi,

You said above:
>export the decomposed geometry matrix g into the command space.

How exactly did you do this? pdetool has an option to export gd (geometry
description matrix), ns and sf into the the command space but I'm not
aware of a way to export the decomposed geometry matrix.

If you export gd, ns, and sf, you can then call decsg to *compute* the
decomposed geometry matrix

g = decsg(gd, sf, ns);

Then the g matrix will have full numerical precision so that there are no
gaps between the edges. The reason for the gaps in your
decomposed geometry matrix may be that it is represented only
to four significant digits. If you want to save a text form for
the decomposed geometry matrix (like you show in your post),
print the entries with 16 significant digits.

Bill

Subject: pde toolbox

From: Sashankh Rao

Date: 15 Mar, 2013 15:53:07

Message: 3 of 3

Hi Bill,

Thanks for your reply.

In the pde toolbox, under the 'Boundary' option, I used the export decomposed geometry matrix to get 'g' into my workspace.

You were right about the significant digits. I have fixed the problem. Thank you.

"Bill Greene" wrote in message <khv4r7$ht1$1@newscl01ah.mathworks.com>...
> "Sashankh Rao" wrote in message <kht5k2$l97$1@newscl01ah.mathworks.com>...
> > Hi,
> >
> > I create a geometry using the pde toolbox GUI. I then export the decomposed geometry matrix g into the command space. Now I try to use the
> > [p,e,t] = initmesh(g) and it works fine.
> >
> > However, if I copy the same g matrix from the command space to an .m file and try to use initmesh I receive the following error:
> > -----------------------------------------------------
> > ??? Error using ==> pdevoron at 32
> > Geometry error.
> >
> > Error in ==> initmesh at 208
> > [p,t,c,h]=pdevoron(p,t,[],h,x,y,tol,Hmax,Hgrad);
> >
> > Error in ==> mhp at 63
> > [p,e,t] = initmesh(g);
> > -----------------------------------------------------
> > I examined my geometry and found that there was a gap. Theoretically the two points must overlap since they are the same. Is this a visualization problem or is there really a gap in my boundary? How can I close this gap? Why does it work in the command space but not when I use the matrix in a .m file. Thanks. Below is my geometry matrix:
> >
> > g =[
> >
> > 2 2 2 2 2 2 2 4
> > 1 0 0.2242 0.7154 0 0.0950 0.4698 1
> > 1 0.2242 0.7154 1 0.0950 0.4698 0.8447 0.8447
> > 0 0 0 0 0 0.0950 0.4698 0.4698
> > 0.4698 0 0 0 0.0950 0.4698 0.8447 0.8447
> > 1 1 1 1 0 0 0 1
> > 0 0 0 0 1 1 1 0
> > 0 0 0 0 0 0 0 0.4698
> > 0 0 0 0 0 0 0 0.4698
> > 0 0 0 0 0 0 0 0.5302
> > 0 0 0 0 0 0 0 0.5302
> > 0 0 0 0 0 0 0 0
> > ];
> >
> > Thanks,
> > - Sai
>
>
> Hi,
>
> You said above:
> >export the decomposed geometry matrix g into the command space.
>
> How exactly did you do this? pdetool has an option to export gd (geometry
> description matrix), ns and sf into the the command space but I'm not
> aware of a way to export the decomposed geometry matrix.
>
> If you export gd, ns, and sf, you can then call decsg to *compute* the
> decomposed geometry matrix
>
> g = decsg(gd, sf, ns);
>
> Then the g matrix will have full numerical precision so that there are no
> gaps between the edges. The reason for the gaps in your
> decomposed geometry matrix may be that it is represented only
> to four significant digits. If you want to save a text form for
> the decomposed geometry matrix (like you show in your post),
> print the entries with 16 significant digits.
>
> Bill

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us