Solved

Matlab Basics - Pick out parts of a vector

Consider x a vector of length >= 7 (there are at least 7 elements in the vector, write a script that extracts the 2nd element, a...

2 years ago

Solved

Matlab Basics - Set unwanted parts of a vector to zero

Consider a vector x, of length >= 7, write a script to set elements 2, 5, and 6 to zero. Example x = [1 2 3 4 5 6 7] --> ...

2 years ago

Solved

Matlab Basics II - Free Fall

An object freely falling from rest under gravity covers a distance x given by: x = 1/2 gt^2 write a function that calculat...

2 years ago

Solved

Replace every 3rd element in a vector with 4

x is a vector of undetermined length You are to replace every 3rd element with the number 4, example: x = [11 23 34 43 2 3...

2 years ago

Solved

Matlab Basics - Create a row vector

Write a Matlab script to create a row vector of 10 consecutive numbers x = [1 2 3 4 5 6 7 8 9 10]

2 years ago

Solved

Matlab Basics - Rounding I

Write a script to round x DOWN to the next lowest integer: e.g. x = 2.3 --> x = 2 also: x = 2.7 --> x = 2

2 years ago

Solved

Create a Multiplication table matrix...

Create a product table in this format: P = [ 1 2 3 4 5; 2 4 6 8 10; 3 6 9 12 15; 4 8 12 1...

2 years ago

Solved

Replacing a row

For matrix G=[1 2 3; 4 5 6; 7 8 9] Replace the 2nd row with 8s **remember to create matrix G

2 years ago

Solved

All your base are belong to us

Find the base _b_ logarithm of the input decimal number _x_. Express the output as a decimal number. The first argument is the n...

2 years ago

Solved

03 - Matrix Variables 4

Make the following variable: <<http://samle.dk/STTBDP/Assignment1_3d.png>> A 3x4 NaN (Not a Number) matrix (Hint: use ...

2 years ago

Solved

Matrix of almost all zeros, except for main diagonal

Write a program to input an integer n and build a n-by-n matrix with the numbers 1,2,...,n on the main diagonal and zeros elsewh...

2 years ago

Solved

Back to basics 7 - Equal NaNs

Covering some basic topics I haven't seen elsewhere on Cody. Given 2 input variables, output true if they are equal, false ot...

2 years ago

Solved

Matlab Basics II - 3 Dimensional Arrays

Assume x is a 3D array with n pages, representing students in a class, for each student (page in the array, the 3rd dimension), ...

2 years ago

Solved

Matlab Basics - y as a function of x

Write a function to calculate y as a function of x, such that y = 6x^2 + 5x - 2

2 years ago

Solved

Matlab Basics II - squares

Write a function that takes matrix A, and squares each element in the matrix example: A = [1 2 3] output = [1 4 9]

2 years ago

Solved

Matlab Basics II - Max & Index of Max

Write a function that takes a vector x, then returns both the max value in x and its location in the vector for example x ...

2 years ago

Solved

Matlab Basics - Absolute Value

Write a script that returns the absolute value of the elements in x e.g. x = [-1 -2 -3 -4] --> y = [1 2 3 4]

2 years ago

Solved

Matlab Basics II - Velocity of a particle

A particle is moving in space, such that it's velocity is given by: <<http://s30.postimg.org/5rf1xtvj5/cody1.png>> write a...

2 years ago

Solved

Matlab Basics II - Intervals

Write a function that takes an interval from a to b, and divides it into 5 parts example: a = 1, b = 2 output = 1 1.25 ...

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

2 years 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

2 years ago

Solved

Matlab Basics - Assigning Variables

Assign different types of data to variables: integer, double, and strings Example: A is a double, for example 2.34 B is a...

2 years ago

Solved

Back to basics 3 - Temp Directory

Covering some basic topics I haven't seen elsewhere on Cody. Return a string that is the path to the system's current temp di...

2 years ago

Solved

Find out value of sine given by degree.

Find out value of sine given by degree. If theta=30, it's value must be 0.5.

2 years ago

Solved

What percentage?

Calculate the output c as the percentage of a on b for given a and b.

2 years ago

Solved

Sum the 'edge' values of a matrix

Sum the 'edge' values of an input matrix (the values along the perimeter). Example [1 2 3 4 5 6 7 8 9] Output = ...

2 years ago

Solved

Vector Multiplication

Vector Multiplication of three matrix as shown in test cases.

2 years ago

Solved

Area of a triangle

A triangle is given with base *'b'* ,vertical hight *'h'* . then find it's area.

2 years ago