Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

help electomagnetic field with matlab

Status
Not open for further replies.

roei

Newbie level 3
Joined
Jun 3, 2010
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,316
I need to draw a triangele inside a circle. the triangele need to be in the center.
the potenzial inside=100 and outside=0
R=80
a=40 width of triangele

this is my work in matlab but I can't defined the triangele in the center.


clear all;
s1=80;
close all;
s2=80;

radius=80;
dx=0.5;
%mx=(-s1/2):dx:(s1/2);
%my=(-s2/2):dx:(s2/2);
mx=(-20):dx:(20);
my=(-20):dx:(20);
int_pot=110;
ext_pot=10;
%V=zeros(s2/dx,s1/dx);
V=zeros(160,160)
%external triangel
%for i=s1/(2*dx):-1:0
% for j=0:(s2/dx)
% if ((s1/(2*dx))-i>j/2)
%ניסוי מס 1
for i=20:-1:0
for j=0:(40)
if (((20))-i>j/2)

V(j+1,i+1)=0;
else
V(j+1,i+1)=int_pot;%
end
end
end

%המשך ניסוי
for i=(20):(40)
for j=0:(40)
if (i-(20)>j/2)
V(j+1,i+1)=0;
else
V(j+1,i+1)=int_pot;%
end
end
end

%for i=(s1/(2*dx)):(s1/dx)
% for j=0:(s2dx)
% if (i-(s1/(2*dx))>j/2)
% V(j+1,i+1)=0;
% else
% V(j+1,i+1)=int_pot;%
%end
% end
%end
%vx=(-s1/2):dx:(s1/2);
%vy=(-s2/2):dx:(s2/2);
%[xx,yy]=meshgrid(vx,vy);
%xx_size=size(xx);
%bb=(radius^2)*ones(xx_size);

%[xxx,yyy]=meshgrid(vx.^2,vy.^2);
%[ix,iy]=find(bb>=yyy+xxx);

%
vx=(-s1):dx:(s1);
vy=(-s2):dx:(s2);
[xx,yy]=meshgrid(vx,vy);
xx_size=size(xx);
bb=(radius^2)*ones(xx_size);

[xxx,yyy]=meshgrid(vx.^2,vy.^2);
[ix,iy]=find(bb>=yyy+xxx);



%עיגול
length_xy=length(ix);
for k=1:length_xy
V(ix(k),iy(k))=ext_pot;%
end
size_v=size(V);
V2=V;
V3=V;
iter=80;
for q = 1:iter
for n = 2:(size_v(1) - 1)
for m = 2:(size_v(2) - 1)
if V2(n,m) == 2
V(n,m) = 0.25*(V(n+1,m) + V(n - 1,m) + V(n,m + 1) + V(n,m - 1));
end
end
end
end

[u,v]=gradient(V,dx);
[xxx,yyy]=meshgrid(vx,vy);

figure(1)
mesh(vx,vy,V);
figure(2);
imagesc(vx,vy,V);
figure(3);
contour(V,40);
figure(4);
quiver(xxx,yyy,u,v,1.5);



thank you.
 

tob draw triangle inside circle....you just need take care of distance...you put three points for triangle with shorter distance of diametre and place in the middle of circle..if you find problem..you can ask me
 

langhnaj21 said:
tob draw triangle inside circle....you just need take care of distance...you put three points for triangle with shorter distance of diametre and place in the middle of circle..if you find problem..you can ask me

hi,

thank's for your helping.

the distance for triangle are "mx/my"
the distance for circle are vx/vy

and after this the triangle located in the corner.

if you can help me to make him in the center??

thank you again
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top