Community Profile

# Agam Sharma

Last seen: 6 days ago Active since 2022

All

#### Content Feed

View by

Solved

Make a Plot with Functions
Make a plot and test

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

11 days ago

Solved

Find the sides of an isosceles triangle when given its area and height from its base to apex
Find the sides of an isosceles triangle when given its area and the height from its base to apex. For example, with A=12 and ...

12 days ago

Solved

Height of a right-angled triangle
Given numbers a, b and c, find the height of the right angled triangle with sides a and b and hypotenuse c, for the base c. If a...

13 days ago

Solved

Longest run of consecutive numbers
Given a vector a, find the number(s) that is/are repeated consecutively most often. For example, if you have a = [1 2 2 2 1 ...

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

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

13 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

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

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

13 days 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,....

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

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

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

14 days ago

Solved

Roll the Dice!
*Description* Return two random integers between 1 and 6, inclusive, to simulate rolling 2 dice. *Example* [x1,x2] =...

15 days ago

Solved

Make a random, non-repeating vector.
This is a basic MATLAB operation. It is for instructional purposes. --- If you want to get a random permutation of integer...

18 days ago

Solved

Swap the input arguments
Write a two-input, two-output function that swaps its two input arguments. For example: [q,r] = swap(5,10) returns q = ...

18 days ago

Solved

Approximation of Pi
Pi (divided by 4) can be approximated by the following infinite series: pi/4 = 1 - 1/3 + 1/5 - 1/7 + ... For a given numbe...

19 days ago

Solved

Sum of series VII
What is the sum of the following sequence: Σ(km^k)/(k+m)! for k=1...n for different n and m?

19 days ago

Solved

Sum of series VI
What is the sum of the following sequence: Σk⋅k! for k=1...n for different n?

19 days ago

Solved

Sum of series V
What is the sum of the following sequence: Σk(k+1) for k=1...n for different n?

19 days ago

Solved

Sum of series IV
What is the sum of the following sequence: Σ(-1)^(k+1) (2k-1)^2 for k=1...n for different n?

19 days ago

Solved

Sum of series III
What is the sum of the following sequence: Σ(2k-1)^3 for k=1...n for different n?

19 days ago

Solved

Sum of series II
What is the sum of the following sequence: Σ(2k-1)^2 for k=1...n for different n?

19 days ago

Solved

Sum of series I
What is the sum of the following sequence: Σ(2k-1) for k=1...n for different n?

19 days ago

Solved

Return the first and last characters of a character array
Return the first and last character of a string, concatenated together. If there is only one character in the string, the functi...

24 days ago

Solved

Magic is simple (for beginners)
Determine for a magic square of order n, the magic sum m. For example m=15 for a magic square of order 3.

24 days ago

Help with Cody's 'Problem 672. Longest run of consecutive numbers', I wrote 'if a(i)==a(i+1)' and it says error
count=zeros(1,length(a)) for i=2:length(a) if(a(i)==a(i-1)) count(i)=count(i-1)+1 end end [m e]=max(count)...

26 days ago | 0

Solved

Solve a System of Linear Equations
Example: If a system of linear equations in x₁ and x₂ is: 2x₁ + x₂ = 2 x₁ - 4 x₂ = 3 Then the coefficient matrix (A) is: 2 ...

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

26 days ago