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...

3 years ago

Solved

Back and Forth Rows

Given a number n, create an n-by-n matrix in which the integers from 1 to n^2 wind back and forth along the rows as shown in the...

3 years ago

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...

3 years 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...

3 years 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...

3 years ago

Solved

Find the numeric mean of the prime numbers in a matrix.

There will always be at least one prime in the matrix. Example: Input in = [ 8 3 5 9 ] Output out is 4...

3 years ago

Solved

Make a checkerboard matrix

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

3 years 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...

3 years ago

Solved

Find all elements less than 0 or greater than 10 and replace them with NaN

Given an input vector x, find all elements of x less than 0 or greater than 10 and replace them with NaN. Example: Input ...

3 years ago

Answered

Eliminate rows from an array

Hello, this is what you tried to achieve: data3(1+length(data3)/2:length(data3),:)=[]; Try to run below example. Hope it helps...

Eliminate rows from an array

Hello, this is what you tried to achieve: data3(1+length(data3)/2:length(data3),:)=[]; Try to run below example. Hope it helps...

3 years ago | 1

Answered

Calculations in the cell array

Hello, Here is what i achieved based on my understanding of your question. Hope it does help. test={1; 2; 3; 4; 5} test=num2...

Calculations in the cell array

Hello, Here is what i achieved based on my understanding of your question. Hope it does help. test={1; 2; 3; 4; 5} test=num2...

3 years ago | 0

Answered

How to add x & y value in the odd and even columns in cell matrix

Hello, Here is what i tried based on my understanding of your question. Hope it does help you. x=99;y=99; %choose your consta...

How to add x & y value in the odd and even columns in cell matrix

Hello, Here is what i tried based on my understanding of your question. Hope it does help you. x=99;y=99; %choose your consta...

3 years ago | 1

| accepted

Answered

How do I specify time increment in computation in for loop?

Hello, I just tried to plot your equation epsilon(t) for time range 0-5s assuming constant value for t0, and arrays Ei and tau_...

How do I specify time increment in computation in for loop?

Hello, I just tried to plot your equation epsilon(t) for time range 0-5s assuming constant value for t0, and arrays Ei and tau_...

3 years ago | 0

Answered

I want to plot this equation P(t)=P(0)*e^rt.

xlim1=0; xlim2=10; r=1; P0=1; % I supposed you will define r and P(0) as constants, and the limits xlim1 % and xlim2 are kn...

I want to plot this equation P(t)=P(0)*e^rt.

xlim1=0; xlim2=10; r=1; P0=1; % I supposed you will define r and P(0) as constants, and the limits xlim1 % and xlim2 are kn...

3 years ago | 0

Answered

how to evaluate?

Hello, The question is not very clear. What do you need to evaluate? Please make your input(s) and outpout(s) explicitly define...

how to evaluate?

Hello, The question is not very clear. What do you need to evaluate? Please make your input(s) and outpout(s) explicitly define...

3 years ago | 0

Solved

Project Euler: Problem 2, Sum of even Fibonacci

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 te...

3 years ago

Solved

Project Euler: Problem 9, Pythagorean numbers

A Pythagorean triplet is a set of three natural numbers, a b c, for which, a^2 + b^2 = c^2 For example, 3^2 + 4^2 =...

3 years ago

Solved

Project Euler: Problem 3, Largest prime factor

The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number being input, input might be ui...

3 years ago

Solved

Project Euler: Problem 6, Natural numbers, squares and sums.

The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ...

3 years ago

Solved

Project Euler: Problem 1, Multiples of 3 and 5

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23...

3 years 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...

3 years ago

Solved

There are 10 types of people in the world

Those who know binary, and those who don't. The number 2015 is a palindrome in binary (11111011111 to be exact) Given a year...

3 years ago

Solved

Given an unsigned integer x, find the largest y by rearranging the bits in x

Given an unsigned integer x, find the largest y by rearranging the bits in x. Example: Input x = 10 Output y is 12 ...

3 years ago

Solved

Find out sum and carry of Binary adder

Find out sum and carry of a binary adder if previous carry is given with two bits (x and y) for addition. Examples Previo...

3 years ago

Solved

Binary code (array)

Write a function which calculates the binary code of a number 'n' and gives the result as an array(vector). Example: Inpu...

3 years ago

Solved

Relative ratio of "1" in binary number

Input(n) is positive integer number Output(r) is (number of "1" in binary input) / (number of bits). Example: * n=0; r=...

3 years ago

Solved

Converting binary to decimals

Convert binary to decimals. Example: 010111 = 23. 110000 = 48.

3 years ago

Solved

Binary numbers

Given a positive, scalar integer n, create a (2^n)-by-n double-precision matrix containing the binary numbers from 0 through 2^n...

3 years ago

Solved

Convert given decimal number to binary number.

Convert given decimal number to binary number. Example x=10, then answer must be 1010.

3 years ago