How to increase the size of "s" using pdegeom?
Mostra commenti meno recenti
I have written a pdegeom file which produce a sinusoidal edge. The standard amount of grid points (size(s)) is set to 50. This is not enough to reproduce approx. 50 periods of the sinus correctly.
The pdegeom file (you can check it with pdegplot('Geom') to see that the sinus is not correctly plotted):
function [ x,y ] = Geom(bs,s)
nbs = 10;
if nargin==0
x=nbs;
return
end
dl=[ 0 1 2 3 4 5 6 7 8 9;
1 2 3 4 5 6 7 8 9 10;
0 0 0 0 0 0 0 0 1 1;
1 1 1 1 2 2 2 1 2 2];
if nargin==1
x=dl(:,bs);
return
end
x=zeros(size(s));
y=zeros(size(s));
[m,n]=size(bs);
if m==1 && n==1,
bs=bs*ones(size(s)); % expand bs
elseif m~=size(s,1) || n~=size(s,2),
error(message('pde:cardg:SizeBs'));
end
nn=size(bs,1)*size(bs,2);
if nn==0
x=[];
y=[];
return
end
for ibs=1:nn
switch bs(ibs)
case 1 % Boundary-Tip down right
xx=50 - (50-10)*s(ibs);
yy=-50 +0*s(ibs);
case 2 % Tip side right
xx=10 - (10-5)*(s(ibs)-1);
yy=-50*(1-(s(ibs)-1));
case 3 % Tip apex half
xx=5*cos(pi/2*(s(ibs)-2));
yy=5*sin(pi/2*(s(ibs)-2));
case 4 % Tip to resist
xx=0*(s(ibs)-3);
yy=5 + ((20-12)-5)*(s(ibs)-3);
case 5 % resist to sample
xx=0*(s(ibs)-4);
yy=(20-12) + (12)*(s(ibs)-4);
case 6 % Sample
xx=50*(s(ibs)-5);
yy=20 + 0*(s(ibs)-5);
case 7 % Boundary right - Resist
xx=50 + 0*(s(ibs)-6);
yy=20 - (12)*(s(ibs)-6);
case 8 % Boundary right
xx=50 + 0*(s(ibs)-7);
yy=(20-12) - ((20-12)-(-50))*(s(ibs)-7);
case 9 % Layer right - Tip side
xx=30*(s(ibs)-8);
yy=(20-12)+3*sin(2*pi/1*xx);
case 10
xx=30-(30-50)*(s(ibs)-9);
yy=20-12+0*(s(ibs)-9);
end
x(ibs)=xx;
y(ibs)=yy;
end
end
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Geometry and Mesh in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!