Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm trying to understand why we're iterating through Mandelbrot points until |z| < 4.
why 4? is there somekind of a law? or is it based on statistical measurements?
thanks, igal
Consider the Mandelbrot set with along y=0, which would would be z(i) = z(i-1)^2 + c.
Consider when c = (x=-2, y=0)
z(0) = 0
z(1) = 0^2 + -2 = -2
z(2) = (-2)^2 + -2 = 4 - 2 = 2
z(3) = 2^2 + -2 = 4 - 2 = 2
z(...) = 2^2 + -2 = 4 - 2 = 2
This example (x=-2,y=0) is the point with the greatest magnitude that will never blow up. Thus when z^2 > 4, there is no point in further iteration since you already know it will blow up.
All other points where the magnitude of the point >= 2 will blow up.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Following advise from another post, I created a basic 3x3 averaging filter as follows:
blurP = zeros(512, 512);
for i = 1:510
for j = 1:510
sum = 0;
for k = i:i+2
for l = j:j+2
sum = sum+P(k,l);
end
end
blurP(i+1,j+1) = mean2(P(i:i+2,j:j+2));
end
end
imshow(P), figure, imshow(blurP, []);
I need to create a weighted filter with two options: One counts the center element (of the 3x3 grid) twice, thus giving me ten elements in total. The other has sixteen elements in total, with the center element counted four times and the adjacent ones counted twice—only the corner elements of the 3x3 grid are counted once.
The easiest option is to just use convolution (via the conv2 function). Then designing your kernels is a simple as writing out exactly what you described:
kernel1 = [1 1 1
1 2 1
1 1 1]/10;
blurP1 = conv2(P, kernel1, 'same');
and
kernel2 = [1 2 1
2 4 2
1 2 1]/16;
blurP2 = conv2(P, kernel2, 'same');
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
A = [A-x(1) B-x(2) C-x(3);D-x(4) E-x(5) F-x(6); G-x(7) H-x(8) I-x(9)]
I have to obtain x(1)...x(9) for det(A) = 0.
Given a 3x3 matrix A
its determinant is
therefore you need to solve |A| = 0. For your case we are given
The easiest solution for x so that |A| = 0 is when
a - x(1) = 0
b - x(2) = 0
c - x(3) = 0
which leads to
x(1) = a
x(2) = b
x(3) = c
so
x = A
is the most trivial solution. There exists an infinite number of solutions to this problem, this is just one. You could choose another solution where
a - x(1) != 0
b - x(2) != 0
c - x(3) != 0
and then you would have to set
ei - fh = 0
di - fg = 0
dh - eg = 0
which would involve simultaneous equations.
I suggest before trying to code up a solution you work through one by hand like I've done here.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to get the minimum row index with specific value in a specific column.
For example,
ma = [8 1 4; 3 1 5; 1 2 4; 1 2 5]
ma =
8 1 4
3 1 5
1 2 4
1 2 5
choosing second column (col = 2) and val = 2, as you can see second column has two elements with value of 2 and I want the one with minimum index (index = 3).
So far I've come up with,
[value1,index1]=min(ma(ma(:,col) == val,1))
value1 =
1
index1 =
1
You should use,
col = 2;
val = 2;
ind = min(find(ma(:,col)==val));
which will give ind = 3.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am new to Matlab and for the values of a, l and w i need to find all the values for l in the data set and the corresponding w values.
a=10;
l=(0:10)
w=(0:10)
for l,d
if a == l.*w
disp(l)
disp(w)
end
end
Not sure what you want to do, but I think your code could be put as follows:
a = 10;
l = 0:a; %// actually, it would suffice to check numbers up to floor(a/2)
ind = rem(a,l)==0; %// logical index that tells if remainder is zero or not
disp([l(ind); a./l(ind)])
Result:
1 2 5 10
10 5 2 1
You could do it more directly with Matlab's factor function:
f = factor(a);
disp([f; a./f])
Result:
2 5
5 2
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a vector [1 2 3 4 ... 100] and another vector storing the numbers I want to delete like [2 3 4]. After deleting, the numbers in original vector should be mapped to another order, for example, 1->1, 5->2, 6->3, etc. Is there any efficient way to do this? Thanks a lot!
I'd use setdiff:
% original vector
A = 1:100;
% elements to be removed
B = [2 3 4 18 21];
% new order (indices)
C = randperm(numel(A)-numel(B));
% Step 1) remove the elements
[D,I] = setdiff(A,B); % ordered
D = A(I); % restore original order
% Step 2) re-order the elements
D = D(C)
You can do:
original_vector = 1:100;
delete_vector = [2 3 4];
for ii = 1:length(delete_vector)
original_vector(original_vector==delete_vector(ii)) = [];
end