Community Profile

# James

### Naval Surface Warfare Ctr

3,066 total contributions since 2012

View all

Contributions in
View by

Solved

Exponentiation
Given 3 integers b,e,k; find -- mod(b^e,k)

9 days ago

Solved

Sieve of Eratosthenes - 02
"Sift the Two's and Sift the Three's, The Sieve of Eratosthenes. When the multiples sublime, The numbers that remain a...

9 days ago

Solved

Projector Matrix
Write a function to determine whether or not the matrix is a projector. Projector matrices are defined as P^2 = P.

9 days ago

Solved

Sky full of stars - 03
draw the following pattern with asterisks. For example, for n=6 '************' '***** *****' '**** ****' ...

9 days ago

Solved

Sky full of stars - 02
draw an isosceles triangle with asterisks of size n. For example, for n=6 ' * ' ' *** ' ' **...

9 days ago

Solved

Sky full of stars - 01
Draw a right triangle with asterisks of size n. For example, for n=5 '* ' '** ' '*** ' '**** ' ...

9 days ago

Solved

Calculate the square root of a number
Input a Output b = srt(a)

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

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

9 days ago

Solved

Calculate Inner Product
Given two input matrices, |x| and |y|, check if their inner dimensions match. * If they match, create an output variable |z|...

9 days ago

Solved

Plot Damped Sinusoid
Given two vectors |t| and |y|, make a plot containing a blue ( |b| ) dashed ( |--| ) line of |y| versus |t|. Mark the minimum...

9 days ago

Solved

Find the Best Hotels
Given three input variables: * |hotels| - a list of hotel names * |ratings| - their ratings in a city * |cutoff| - the rat...

9 days ago

Solved

Calculate days until Christmas
Provided with inputs year, month, day e.g. 2019,11,12, calculate the number of days until the next Christmas day, i.e. the next ...

9 days ago

Solved

microseconds passed today
Calculate the amount of microseconds passed for a given date string. Return the value, rounded to the nearest integer, as a stri...

9 days ago

Solved

calculate the day of the year from a date string.
'09-Oct-2016' is the 283rd day of the year. So doy = dayoftheyear('09-Oct-2016') should return doy = 283

9 days ago

Solved

Pentago: find winning move
<http://en.wikipedia.org/wiki/Pentago Pentago> is a challenging two-player strategy game. The objective is to be the first playe...

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

13 days ago

Solved

Calculate BMI
Given a matrix |hw| (height and weight) with two columns, calculate BMI using these formulas: * 1 kilogram = 2.2 pounds * 1 ...

13 days ago

Solved

Calculate a Damped Sinusoid
The equation of a damped sinusoid can be written as |y = A.&#8519;^(-&lambda;t)*cos(2πft)| where |A|, |&lambda;|, and |f| ...

13 days ago

Solved

Solve a System of Linear Equations
*Example*: If a system of linear equations in _x&#8321_ and _x&#8322_ is: 2 _x&#8321;_ + _x&#8322;_ = 2 _x&#8321;...

13 days ago

Solved

Find the Oldest Person in a Room
Given two input vectors: * |name| - user last names * |age| - corresponding age of the person Return the name of the ol...

13 days ago

Solved

Convert from Fahrenheit to Celsius
Given an input vector |F| containing temperature values in Fahrenheit, return an output vector |C| that contains the values in C...

13 days ago

Solved

Calculate Amount of Cake Frosting
Given two input variables |r| and |h|, which stand for the radius and height of a cake, calculate the surface area of the cake y...

13 days ago

Solved

Find the complement of a number in binary
Input x is a decimal number and output y is the complement of binary representation of x. For example, x = 10 has the binary ...

6 months 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,....

6 months ago

Solved

Simple spirometer - find your lung capacity from the number and size of soap bubbles in one breath
Assumed that each bubble has practically the same diameter d. Given total number n of bubbles. Find volume v of breath.

9 months ago

Solved

Minimum possible M of the maximum side of a triangle of given area A.
Suppose a triangle has area A. Suppose it has three sides S1, S2, and S3. Suppose M = max([S1 S2 S3]). What is the minimum po...

9 months ago

Solved

Probability of red tulips
I hope to give you bulbs of tulip. But I do not know the color of those petals. I just know that the color is red, white or yell...

9 months ago

Solved

Datetime basics
Generate the datetime scalar representing the current date

9 months ago

Solved

Calculate the square of a number (Super Easy)
The goal is to calculate the square (y) of a number (x). Good way to start MatLab for beginners.

9 months ago