charge simulation method

how can I choose points from the surface of a circle? how can I subtract each element of a matrix from the other elements of the same matrix?

3 Kommentare

ahmed
ahmed am 8 Dez. 2011
help me plzzzzzz
Fangjun Jiang
Fangjun Jiang am 8 Dez. 2011
You need to clarify your question. What is the surface of a circle? For the second part, could you provide an example?
ahmed
ahmed am 8 Dez. 2011
1) we plot a circle and i need to choose 4 points on it
2) if i've a matrix:
f=[x1 x2 x3]
so
i wanna have:
z=[x1-x2 x1-x3 x2-x1 x2-x3 x3-x1 x3-x2]

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Fangjun Jiang
Fangjun Jiang am 8 Dez. 2011

0 Stimmen

f=[1 2 3];
g=bsxfun(@minus,f,f.')
The other question depends on how you plot it and how do you want to choose the point.

4 Kommentare

ahmed
ahmed am 9 Dez. 2011
the circle that I plot:
theta=linspace(0,2*pi,100);
xcenter=5;
ycenter=1;
radius=4;
x=xcenter+(radius*cos(theta));
y=ycenter+(radius*sin(theta));
plot (x,y,'r')
hold on
Fangjun Jiang
Fangjun Jiang am 9 Dez. 2011
That's good! How do you want to choose the 4 points? Randomly?
Fangjun Jiang
Fangjun Jiang am 9 Dez. 2011
N=length(x);
m=randperm(N);
m=m(1:4);
x_select=x(m);
y_select=y(m);
plot(x_select,y_select,'b*');
ahmed
ahmed am 22 Dez. 2011
if i have this variable
p=[p1 p2 p3;p4 p5 p6]
and i want to differential "p" to "x"
x=points on a circle
????

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by