Coloring houses with 4 colours [closed] - discrete-mathematics

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I am stuck on this question:
What is the number of possible arrangements of N houses in a circle given that no two consecutive houses can have the same color (red, green, blue or white)?
Can anyone give me any tips on how to solve it?

I will give it a try: Number Of possible arrangements = (number of permutations) - 4*(all have the same color) - 4*(number of combinations of adjacent 3 houses in 4 elements) - 4*(number of combinations of 2 houses in 4 elements)

Related

How to change the line color in a plot using geoplot? [closed]

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 3 years ago.
Improve this question
I want to use geoplot command to show latitude and longitude and change the line color using a third variable speed. Speed is a array of size (120,3). How can I do this considering that I want to represent my data on a map (using geoplot)? The colour and corresponding value can be checked with colourbar.
I am using MATLAB.
Have a look at the documentation of geoplot. Use the name-value pair 'Color','r' to configure red lines in this case (r:red, k:black, b:blue, g:green,... or use a 3x1 RGB array (normalized), see here). You can also use the keyword 'LineStyle' to set e.g. dashed lines.
c = [1 0 0]; % RGB | [255 0 0]/255
geoplot(...,'Color',c);

Matlab : Opposite function of "primes" in matlab [closed]

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
Is there any opposite function of "primes" in matlab?
(Primes : Prime numbers less than or equal to input value)
What if i want to find greater than or equal to input value?
Thank you.
You always have to provide an upper limit. If you wanted prime numbers "greater than or equal to the given value," they would go to infinity.
I would suggest starting with "less than or equal to," provide the function with an upper limit, and then use a conditional to filter out those that are too small.

Two dimensional matrix in Perl [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Newbie's question: What does $matrix[$row][4]=1; mean in a code? The row and column are known to me. Why is it made equal to 1?
The command will set the cell at position $row,4 with the value 1
= is the assignment operator in Perl. It assigns the value 1 to the cell at the coordinates $row, 4.
The comparison operators for equiality are eq for strings and == for numbers.

Basic Matlab tables containing text [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I need to type some matrix containing both letters and numbers.
Something like list=["a" 1;" b" 2; "c" 3; "d" 4; "e" 5; "f" 6; "g" 7]
Can anybody give me some tip?
If you want "just" a mix of strings and numbers, use a cell array. See the MATLAB documentation here.
If you're trying to set up some kind of map/hash, you want a MATLAB "structure." See the documentation for that here.

How can I apply a ring-shaped median filter to an image in matlab? [closed]

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 9 years ago.
Improve this question
The default matlab function medfilt2 uses a rectangular mask.
Thanks guys
you can use ordfilt2 .
For example, if your "ring" is just defined by:
ring= fspecial('gaussian',21,1)
ring = ring>eps & ring<1e-9
then:
order=sum(ring(:))/2;
B = ordfilt2(A,order,ring);
replaces each element in A by the order-th element in the sorted set of neighbors specified by the nonzero elements in the ring domain.
Here I chose 'order' to be half the total # of the pixels in the ring.