Intertwine 0s betweeen bits SystemVerilog [closed] - system-verilog

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 1 year ago.
Improve this question
I want to intertwine 0s between the bits of a variable. For example, imagine I have a variable a as follows
a = 1101
Then, I want to obtain the following result
b = 1_000000_1_000000_0_000000_1
That results from intertwining 6 0s betwen each bit of a. I was wondering if there was any elegant way of doing this in SystemVerilog. Any help is appreciated.

b = 0;
foreach (a[i]) b[i*7] = a[i];

Related

Simplify expression with unknown [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 4 months ago.
Improve this question
I am trying to simplify an expression which has an unknown varaible in it. I am doing it in scala and I am using case classes. The thing is I don't know how to handle an unknown variable e.g when 4 * 4 * x should become 16 * x but I don't know how to get the * x. Can anyone help

how to create a signal consisting of a delay of 1000 samples of zeros? [closed]

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
How to write the MATLAB code
to create a signal consisting of a 'delay' of 1000 samples of zeros,
followed by variable which i found in previous part 'sss' of 1000 samples and the message I've created 'msg' ?
so there are three variables 'delay' , 'sss' , and 'msg'
please help. thanks
Concatenate them.
newSignal = [delay sss msg];

loop to add present state with previous state [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 8 years ago.
Improve this question
I want to make a loop in order to add the current state with the previous state.
For example:
M=1000;
for i=1:M A=i*(x(i));
This formula will be for M=1 but when M=2 the formula will be like this:
A=(i*(x(i))+((i-1)*(x(i-1)))
and when M=3 the formula will be
A=(i*(x(i))+((i-1)*(x(i-1)))+((i-2)*(x(i-2))
and so on till reach the maximum length of M which is 1000.
Your question is quite vague but it sounds like you just want a cumulative sum of the i*x(i) series:
i = 1:M;
s = i.*x(i);
cumsum(s);

Optimization using ga algorithm [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
I need to do an optimization problem using ga algorithm. The number of decision variable is 3. i.e 3 x 1 matrix. but first element is always 0. keeping this as reference I want to optmize other two variables. How can I do this task?
Then just use
lb = [0,0,0];
ub = [0,8,8];
IntCon = [0 2 3];

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.