Solved

Sums with Excluded Digits

Add all the integers from 1 to n in which the digit m does not appear. m will always be a single digit integer from 0 to 9. no...

4 months ago

Solved

Balanced number

Given a positive integer find whether it is a balanced number. For a balanced number the sum of first half of digits is equal to...

4 months ago

Solved

Find common elements in matrix rows

Given a matrix, find all elements that exist in every row. For example, given A = 1 2 3 5 9 2 5 9 3 2 5 9 ...

4 months ago

Solved

Find the peak 3n+1 sequence value

A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

4 months ago

Answered

Please help. Error of index out of bounds

The following errors were there in your code: inappropriate spaces in for loops spaces between clear and the variable associat...

Please help. Error of index out of bounds

The following errors were there in your code: inappropriate spaces in for loops spaces between clear and the variable associat...

4 months ago | 0

| accepted

Answered

Multiplying 2 Matrices A and B from Scratch (not built in function

Here you go function result = mult(a, b) [r1, c1] = size(a); [r2, c2] = size(b); if( c1 == r2) result...

Multiplying 2 Matrices A and B from Scratch (not built in function

Here you go function result = mult(a, b) [r1, c1] = size(a); [r2, c2] = size(b); if( c1 == r2) result...

4 months ago | 0

Answered

Display Complete output in Command Window

You can display the output of the matrix by using the disp command. % Let a be the matrix of dim 3200 * 3200 disp(a) % display...

Display Complete output in Command Window

You can display the output of the matrix by using the disp command. % Let a be the matrix of dim 3200 * 3200 disp(a) % display...

4 months ago | 0

Answered

How to eliminate certain columns from a matrix

Let the matrix be a. You can remove the odd columns of a matrix by : a(:,1:2:end) = [] % 1:2:end runs a loop from 1 till th...

How to eliminate certain columns from a matrix

Let the matrix be a. You can remove the odd columns of a matrix by : a(:,1:2:end) = [] % 1:2:end runs a loop from 1 till th...

4 months ago | 1

Answered

how can we perform 6x6 matrix without values to find the inverse and determination

You can calculate the inverse and determinant of a any n*n matrix using these inbuilt functions: det(x) inv(x)

how can we perform 6x6 matrix without values to find the inverse and determination

You can calculate the inverse and determinant of a any n*n matrix using these inbuilt functions: det(x) inv(x)

4 months ago | 0

Answered

How can I generate a code for this equation?

You can use the following code for this a = [429.494, 93.112, -6.050]; N = 1024; temp = 0; lambda = zeros(1, N) for i = 1:N...

How can I generate a code for this equation?

You can use the following code for this a = [429.494, 93.112, -6.050]; N = 1024; temp = 0; lambda = zeros(1, N) for i = 1:N...

4 months ago | 0

| accepted

Answered

Ascii to char conversion and vice versa

You can get the ascii values of a character by double('a') and character value to ascii by char(97)

Ascii to char conversion and vice versa

You can get the ascii values of a character by double('a') and character value to ascii by char(97)

5 months ago | 0

Solved

Pangrams!

A pangram, or holoalphabetic sentence, is a sentence using every letter of the alphabet at least once. Example: Input s ...

5 months ago

Solved

Remove any row in which a NaN appears

Given the matrix A, return B in which all the rows that have one or more <http://www.mathworks.com/help/techdoc/ref/nan.html NaN...

5 months ago

Solved

Who Has the Most Change?

You have a matrix for which each row is a person and the columns represent the number of quarters, nickels, dimes, and pennies t...

5 months ago

Solved

Find the longest sequence of 1's in a binary sequence.

Given a string such as s = '011110010000000100010111' find the length of the longest string of consecutive 1's. In this examp...

5 months ago

Solved

Return the 3n+1 sequence for n

A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

5 months ago

Solved

Most nonzero elements in row

Given the matrix a, return the index r of the row with the most nonzero elements. Assume there will always be exactly one row th...

5 months ago

Solved

Remove all the consonants

Remove all the consonants in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill'; Output s2 is 'a ...

5 months ago

Solved

Which values occur exactly three times?

Return a list of all values (sorted smallest to largest) that appear exactly three times in the input vector x. So if x = [1 2...

5 months ago

Solved

Return the largest number that is adjacent to a zero

This example comes from Steve Eddins' blog: <http://blogs.mathworks.com/steve/2009/05/27/learning-lessons-from-a-one-liner/ Lear...

5 months ago

Solved

Remove the vowels

Remove all the vowels in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill' Output s2 is 'Jck nd Jll wn...

5 months ago

Solved

Summing digits

Given n, find the sum of the digits that make up 2^n. Example: Input n = 7 Output b = 11 since 2^7 = 128, and 1 + ...

5 months ago

Answered

How can I swap two columns of a matrix in MATLAB?

There is an easy way to extract a column of a matrix in MATLAB Suppose you have a matrix A: A = [1, 2, 3 ; 4, 5, 6] and you...

How can I swap two columns of a matrix in MATLAB?

There is an easy way to extract a column of a matrix in MATLAB Suppose you have a matrix A: A = [1, 2, 3 ; 4, 5, 6] and you...

5 months ago | 0

Answered

Randomly initialise a matrix with numbers between 0 and 1?

You can initialise a random matrix with uniform distribution between 0 and 1 by the following: randomMatrix = rand(2,5)

Randomly initialise a matrix with numbers between 0 and 1?

You can initialise a random matrix with uniform distribution between 0 and 1 by the following: randomMatrix = rand(2,5)

5 months ago | 0

Solved

Weighted average

Given two lists of numbers, determine the weighted average. Example [1 2 3] and [10 15 20] should result in 33.333...

5 months ago

Solved

Sum all integers from 1 to 2^n

Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.

5 months ago

Solved

Finding Perfect Squares

Given a vector of numbers, return true if one of the numbers is a square of one of the other numbers. Otherwise return false. E...

5 months ago

Solved

Swap the first and last columns

Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becomes the first. All oth...

5 months ago

Solved

Fibonacci sequence

Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: Inpu...

5 months ago