Answered

Create an string array with strings having both char and numbers

k=[]; for n=1:25; k=[k,string(sprintf('Analysis_%d',n))]; end

Create an string array with strings having both char and numbers

k=[]; for n=1:25; k=[k,string(sprintf('Analysis_%d',n))]; end

10 días ago | 1

| accepted

Answered

Indexing vectors in a cell matrix with for loops?

newmat=zeros(1500,8) for k=1:8 t=yourCell{k}(1:3,:); t=t'; newmat(:,k)=t(:); end

Indexing vectors in a cell matrix with for loops?

newmat=zeros(1500,8) for k=1:8 t=yourCell{k}(1:3,:); t=t'; newmat(:,k)=t(:); end

11 días ago | 0

Solved

Generate a vector which contains a pyramid pattern (★★★★)

Generate a vector that contains terms that follows a pyramid pattern up to the nth row: 1 2 2 3 3 3 4 4 4 4 ...

11 días ago

Solved

Extract leading non-zero digit (★★★★★)

(Copy of Problem 47) Benford's Law states that the distribution of leading digits is not random. This is probably because man...

11 días ago

Solved

Matrix Indexing

Given a matrix A and scalars r,c,i, find the product of two elements, with the first element located at row r and column c (doub...

11 días ago

Solved

Matrix convolution

A certain convolution step involves an elementwise multipication between two 3x3 matrices and taking the resulting sum of the el...

11 días ago

Solved

Stacking vectors into a matrix

Given a 4x1 vector a, and a 2x2 matrix b, create a matrix M in which the first 2 rows are each identical to a and the last two r...

11 días ago

Solved

Logarithmically spaced vector creation using linspace

Create a vector y containing n logarithmically spaced values between a and b, with a < b. Avoid using logspace and use the linsp...

11 días ago

Solved

Logarithmically spaced vector creation using logspace

Create a vector y containing n logarithmically spaced values between a and b, with a < b. Use the logspace operator.

11 días ago

Solved

Vector creation using colon operator

Create a vector y containing n uniformly spaced values between a and b, with a < b. Use the colon (:) operator.

11 días ago

Answered

How do I add values of a function to a matrix?

nada=zeros(64); for a=1:64 for b=1:64 nada(a,b)=delta(a,b); end end

How do I add values of a function to a matrix?

nada=zeros(64); for a=1:64 for b=1:64 nada(a,b)=delta(a,b); end end

11 días ago | 0

Solved

Make a checkerboard matrix (★★★★★)

(copy of Prob. 4) Given an integer n, make an n-by-n matrix made up of alternating ones and zeros as shown below. The a(1...

12 días ago

Solved

Vector creation using linspace

Create a vector y containing n uniformly spaced values between a and b, with a < b. Use linspace.

12 días ago

Solved

Determine the average number of rounds for the following game.

Each round a uniformly distributed random number is picked between 0 and 1. The game ends when the sum of the random numbers is ...

13 días ago

Solved

Compute a sum of Ramanujan

Srinivasa Ramanujan defined the following function: Write a function to compute for various values of . See also Cody Proble...

13 días ago

Solved

Right shift an array n times with constant space.

Right shift an array n times with constant space, that is, no extra array can be used. Right shift operation: Last element com...

13 días ago

Solved

SatCom #6: Inclination of a Sun-Synchronous Orbit

*Satellite and Space Engineering - Problem #5* _This is part of a series of problems looking at topics in satellite and space...

15 días ago

Solved

Calculate Engine Power

Calculate Engine Power (P) in kW given the values of Torque(M) in Nm and Engine Speed(n) in rpm

15 días ago

Solved

Compute the missing quantity among P, V, T for an ideal gas

Consider 100 mol of helium gas at a certain pressure (P), volume (V), and temperature (T). Assuming that the ideal gas law appli...

15 días ago

Solved

Electrical Diode Current Calculation

In engineering, there is not always a single equation that describes a phenomenon accurately enough to be applied in all instanc...

15 días ago

Answered

conditional representation of logical numbers

a='111110011111000000011000011111'; a=strrep(a,'1001','111'); a=strrep(a,'101','111'); a=strrep(a,'010','000'); a=strrep(a,'...

conditional representation of logical numbers

a='111110011111000000011000011111'; a=strrep(a,'1001','111'); a=strrep(a,'101','111'); a=strrep(a,'010','000'); a=strrep(a,'...

15 días ago | 0

| accepted

Solved

Most Frequent Word - 01

Given a document file or a character array, find out the most frequent word in that document. In the case of multiple words -...

15 días ago

Solved

Find the smallest integer m such that n divides m!

Write a function that takes an integer and finds the smallest integer whose factorial is divisible by . For example, if , then...

15 días ago

Solved

Goldbach's marginal conjecture - Write integer as sum of three primes

Goldbach's strong conjecture states that every even integer greater than 2 can be expressed as the sum of two primes. For exampl...

15 días ago

Solved

Twins in a Window

<http://en.wikipedia.org/wiki/Twin_primes Twin primes> are prime numbers that differ by 2, such as [11,13] or [41,43]. Write a f...

15 días ago

Answered

How to solve an inequality

f=@(x)15*x-15+0.41*(sqrt(1/60516+1/123*(15*x-2.9))-1/246)^2*3000-2.9; g=@(x)1/60516+1/123*(15*x-2.9); x=[fzero(g,.2),fzero(f,....

How to solve an inequality

f=@(x)15*x-15+0.41*(sqrt(1/60516+1/123*(15*x-2.9))-1/246)^2*3000-2.9; g=@(x)1/60516+1/123*(15*x-2.9); x=[fzero(g,.2),fzero(f,....

15 días ago | 0

| accepted

Answered

Sort columns to get the lowest possible difference in every row

A for-loop can go through 200,000 cycles quite fast. Not sure there is an easiler way. a=A(:,1); b=A(:,2); tol=3; for k=1:si...

Sort columns to get the lowest possible difference in every row

A for-loop can go through 200,000 cycles quite fast. Not sure there is an easiler way. a=A(:,1); b=A(:,2); tol=3; for k=1:si...

15 días ago | 0

Solved

Find similar sequences

Another problem inspired by a question on the <http://www.mathworks.com/matlabcentral/answers answers> forum. Given a matrix ...

16 días ago