Answered

sum of row in pattern

k=unique(Data(:,1:2)); y=zeros(length(k),2); for m=1:length(k) y(m,:)=[k(m),sum(Data(logical(ismember(Data(:,1),k(m))+ism...

sum of row in pattern

k=unique(Data(:,1:2)); y=zeros(length(k),2); for m=1:length(k) y(m,:)=[k(m),sum(Data(logical(ismember(Data(:,1),k(m))+ism...

circa 4 ore ago | 0

Solved

Determine digits of the Copeland-Erdos constant

<https://www.mathworks.com/matlabcentral/cody/problems/1477-champernowne-constant/solutions/new Cody Problem 1477> asks us to de...

circa 4 ore ago

Solved

Cumulative difference

Given an array, return the cumulative difference. Example a = [ 1 3 5 7 ] cumdiff = [ 1 2 1 -2 ]

circa 5 ore ago

Solved

Find index of a string in a cell array

Write a function that finds the index at which the cell array of strings C contains the exact string S. So if C = {'twe...

circa 6 ore ago

Solved

basic matrix operations: rotate and find sum of diagonal elements of the resultant matrix

For given input matrix a, rotate it by 90 degrees and find the sum of the diagonals. Example: Input: a = 1 ...

circa 6 ore ago

Solved

S-T-R-E-T-C-H I-T O-U-T

You will be given a row of numbers (x), and a single number (n). Your job is to write a script that will stretch out the row of...

1 giorno ago

Solved

Given a number N, find the smallest prime P>N

Given a number N, find the smallest prime P greater than N. For example: If N=10 then P=11. If N=13 then P=17.

1 giorno ago

Solved

Weave two matrices together to form one matrix

Take the first column from matrix a, then insert the first column from matrix b, and so on. For example: a = [1 2 3 4]; b ...

1 giorno ago

Solved

means

Calculate the arithmetic, the geometric and the harmonic mean of a given vector (with positive elements) and return them in a ve...

1 giorno ago

Solved

Toeplitz Matrix

For a given square matrix of order n-by-n check whether this is a Toeplitz matrix or not. Return true if it is.

1 giorno ago

Solved

User defined nextpow function

Create a function which will take 2 arguments as n and x, and return y, where, n^y >= abs(x). [ Similar to builtin "nextpow2" fu...

1 giorno ago

Solved

how many of the entries are positive?

Given x= sin(linspace(0,10*pi,100)), how many of the entries are positive?

1 giorno ago

Answered

arg min for Optimization problem

norm(X-A.*w-B.*v,-inv);%I assume you want element wise multiplication

arg min for Optimization problem

norm(X-A.*w-B.*v,-inv);%I assume you want element wise multiplication

1 giorno ago | 0

Answered

How to get part of 2D array from a 2D array. (i.e. 4x4 array to 2x2x4)

A=reshape([a(1:2,:),a(3:4,:)],2,2,4);

How to get part of 2D array from a 2D array. (i.e. 4x4 array to 2x2x4)

A=reshape([a(1:2,:),a(3:4,:)],2,2,4);

2 giorni ago | 0

Solved

Calculate the h-index

H-index is a powerful tool for quantifying the scientific contribution of a researcher. H-index is defined as follows (source - ...

2 giorni ago

Solved

Calculator spelling - Numbers to Letters

Using the numbers on a calculator, and rotating the display 180 degrees, many words can be spelled. In particular, the following...

2 giorni ago

Solved

Leftovers? Again?!

I am thinking of a positive number X. To determine what number I am thinking of, I will give you two 1xN vectors. The first ve...

2 giorni ago

Solved

My Problem, Find the square of the horizontal concatenation of the third and fifth elements of a vector.

given the 1x5 vector x, y must be the square of the horizontal concatenation of the third and fifth elements. So, if x = [1 1 1 ...

2 giorni ago

Solved

Pattern Sum

Write a function which receives two single digit positive integers, (k and m) as parameters and calculates the total sum as: k...

2 giorni ago

Solved

Electric Flux

Calculate the flux passing through a surface. E is electric field, A is area.

2 giorni ago

Solved

number of groups

In a classroom, *n* students work on a special project and the other students work in groups of five. If there are 18 students i...

2 giorni ago

Solved

first step for Huffman Coding (easy)

Given a string, you must sort the characters by occurrence (from lowest to highest). This step is necessary to generate a Huf...

3 giorni ago

Solved

Guess

A random number between 1 and 10 is created for the variable y. Guess what its value is.

3 giorni ago

Solved

Divide the Least Common Multiple by the Greatest Common Divisor of two numbers

Divide the Least Common Multiple by the Greatest Common Divisor of two numbers. For example, for x=12345 and y=54321, the answer...

3 giorni ago

Solved

Insert Special character in character cell array.

input={'a','b','c'} then ans={'a','*','b','*','c'}

3 giorni ago

Solved

Deleting Specific part.

if input is x= { /*[0..10]*/ 0, 11, 21, 31, 41, 55, 50, 10, 810, 9.10, /*[10...25]*/ 100, 110, 120, 130, 140, 255 ...

3 giorni ago

Solved

Replace Negative(-) by 0 and positive by 1

In a given Matrix Replace all element having *Negative sign with 0* and *Positive elements with 1* .

3 giorni ago

Solved

Help the Patriots get to the Super Bowl

Given a football by the Patriots, return it to them with 2 psi less air in it. (The original psi is passed as a number to the...

3 giorni ago