Let's run that code

Solved

Getting the indices from a vector

This is a basic MATLAB operation. It is for instructional purposes. --- You may already know how to <http://www.mathworks....

21 days ago

Solved

Cell joiner

You are given a cell array of strings and a string delimiter. You need to produce one string which is composed of each string fr...

1 month ago

Solved

Fibonacci-Sum of Squares

Given the Fibonacci sequence defined by the following recursive relation, * F(n) = F(n-1) + F(n-2) * where F(1) = 1 and F(1)...

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

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

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

1 month ago

Solved

Triangle Numbers

Triangle numbers are the sums of successive integers. So 6 is a triangle number because 6 = 1 + 2 + 3 which can be displa...

1 month ago

Solved

Find the maximum number of decimal places in a set of numbers

Given a vector or matrix of values, calculate the maximum number of decimal places within the input. Trailing zeros do not coun...

1 month ago

Solved

Make roundn function

Make roundn function using round. x=0.55555 y=function(x,1) y=1 y=function(x,2) y=0.6 y=function(x,3) ...

1 month ago

Solved

Rounding off numbers to n decimals

Inspired by a mistake in one of the problems I created, I created this problem where you have to round off a floating point numb...

1 month ago

Solved

Matlab Basics - Rounding III

Write a script to round a large number to the nearest 10,000 e.g. x = 12,358,466,243 --> y = 12,358,470,000

1 month ago

Solved

Matlab Basics - Rounding II

Write a script to round a variable x to 3 decimal places: e.g. x = 2.3456 --> y = 2.346

1 month ago

Solved

Check that number is whole number

Check that number is whole number Say x=15, then answer is 1. x=15.2 , then answer is 0. <http://en.wikipedia.org/wiki/Whole...

1 month ago

Solved

MATLAB Basic: rounding IV

Do rounding towards plus infinity. Example: -8.8, answer -8 +8.1 answer 9 +8.50 answer 9

1 month ago

Solved

MATLAB Basic: rounding III

Do rounding towards minus infinity. Example: -8.8, answer -9 +8.1 answer 8 +8.50 answer 8

1 month ago

Solved

MATLAB Basic: rounding II

Do rounding nearest integer. Example: -8.8, answer -9 +8.1 answer 8 +8.50 answer 9

1 month ago

Solved

MATLAB Basic: rounding

Do rounding near to zero Example: -8.8, answer -8 +8.1 answer 8

1 month ago

Solved

Target sorting

Sort the given list of numbers |a| according to how far away each element is from the target value |t|. The result should return...

1 month ago

Solved

Find MPG of Lightest Cars

The file |cars.mat| contains a table named |cars| with variables |Model|, |MPG|, |Horsepower|, |Weight|, and |Acceleration| for ...

1 month ago

Solved

Crop an Image

A grayscale image is represented as a matrix in MATLAB. Each matrix element represents a pixel in the image. An element value re...

1 month ago

Solved

Rescale Scores

Each column (except last) of matrix |X| contains students' scores in a course assignment or a test. The last column has a weight...

1 month ago

Solved

Verify Law of Large Numbers

If a large number of fair N-sided dice are rolled, the average of the simulated rolls is likely to be close to the mean of 1,2,....

1 month ago

Solved

Sum of diagonal of a square matrix

If x = [1 2 4; 3 4 5; 5 6 7] then y should be the sum of the diagonals of the matrix y = 1 + 4 + 7 = 12

1 month ago

Solved

Calories in a slice of pizza?

The total calories C in a pizza is printed on its box. You know the angle A (degrees) of the slice you placed on your plate. Ple...

1 month ago

Solved

Doubling elements in a vector

Given the vector A, return B in which all numbers in A are doubling. So for: A = [ 1 5 8 ] then B = [ 1 1 5 ...

1 month ago

Solved

Flip the vector from right to left

Flip the vector from right to left. Examples x=[1:5], then y=[5 4 3 2 1] x=[1 4 6], then y=[6 4 1]; Request not ...

1 month ago

Solved

Select every other element of a vector

Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

1 month ago

Solved

Given a square and a circle, please decide whether the square covers more area.

You know the side of a square and the diameter of a circle, please decide whether the square covers more area.

1 month ago