Mechanical Engineering, IIT Guwahati

Solved

calculate PI without using pi function

There are many methods to get the pi(Ratio of circumference to diameter). You should get pi without using the pi function in M...

11 jours ago

Solved

Split a string into chunks of specified length

Given a string and a vector of integers, break the string into chunks whose lengths are given by the elements of the vector. Ex...

environ 2 mois ago

Solved

Project Euler: Problem 4, Palindromic numbers

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 ...

environ 2 mois ago

Solved

Project Euler: Problem 8, Find largest product in a large string of numbers

Find the greatest product of five consecutive digits in an n-digit number. 73167176531330624919225119674426574742355349194934...

environ 2 mois ago

Solved

Project Euler: Problem 5, Smallest multiple

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smalle...

environ 2 mois ago

Solved

How many bottles can you drink?

Sometimes if you buy a drink in a glass bottle you can return that bottle and get some money back. Let's assume we have "x" a...

environ 2 mois ago

Solved

Generate a random matrix A of (1,-1)

Input n: is an positive integer which serves as the dimension of the matrix A; Output: A=(Aij),where each entry Aij is either...

environ 2 mois ago

Solved

Moving average (variable kernel length)

Find the moving average in a vector. The kernel length is a variable. For example x = 1:10 kernel_length = 2 would r...

environ 2 mois ago

Solved

Vector of numbers divisible by 3

* Input(n) - any integer * Output(v) - vector with numbers divisible by 3(exept 0) starting from n to 0 Examples: * n=6...

environ 2 mois ago

Solved

Summing Rows and Columns

Create a matrix y of size (n+1) whose last column's elements are the summation of the elements of all the other columns and last...

environ 2 mois ago

Solved

Change the sign of even index entries of the reversed vector

change the signs of the even index entries of the reversed vector example 1 vec = [4 -1 -2 9] ans = [9 2 -1 -4] example2...

environ 2 mois ago

Solved

Divisors of an integer

Given a number N, return a vector V of all integers that divide N. For example, N = 10 Then V=[1 2 5 10]

environ 2 mois ago

Solved

Generate this matrix

Generate the following matrix. n = 2; out = [-4 -3 -2 -1 0 -3 -2 -1 0 1 -...

environ 2 mois ago

Solved

Delete 2nd and 5th column of Given 6*6 matrix

Delete the 2nd and 5th columns of the given 6*6 matrix. Example Suppose A = magic(6) 35 1 6 26 19 ...

environ 2 mois ago

Solved

Cell Counting: How Many Draws?

You are given a cell array containing information about a number of soccer games. Each cell contains one of the following: * ...

environ 2 mois ago

Solved

Create a cell array out of a struct

Create a cell array out of a (single) struct with the fieldname in the first column and the value in the second column: in: ...

environ 2 mois ago

Solved

Find nearest prime number less than input number

Find nearest prime number less than input number. For example: if the input number is 125, then the nearest prime number whi...

environ 2 mois ago

Solved

generate the matrix

given a value n (say 4) - generate the matrix like below y= [0 1 2 3 4; -1 0 1 2 ...

environ 2 mois ago

Solved

Finding an element in a vector

x is a vector of unknown length your function should return the index of the first element in the vector that is greater than...

environ 2 mois ago

Solved

NO _________ ALLOWED....

So you're given a sentence where if there is a particular word in the sentence then the output is 1, if it is not there then the...

environ 2 mois ago

Solved

String Array Basics, Part 2: Convert String Array to Cell Array; No Missing Values

<http://www.mathworks.com/help/matlab/characters-and-strings.html String array> and cell array are two types of containers for s...

environ 2 mois ago

Solved

String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values

<http://www.mathworks.com/help/matlab/characters-and-strings.html String array> and cell array are two types of containers for s...

environ 2 mois ago

Solved

Convert a numerical matrix into a cell array of strings

Given a numerical matrix, output a *cell array of string*. For example: if input = 1:3 output is {'1','2','3'} whic...

environ 2 mois ago

Solved

Fix the last element of a cell array

Note: this is lifted directly from <http://www.mathworks.com/matlabcentral/answers/82825-puzzler-for-a-monday Puzzler for a Mond...

environ 2 mois ago

Solved

Shift elements of vector left

Shift elements of vector to the left. For ex. : Input_vec = [1 2 3 4 5] Output_vec = [2 3 4 5 1]

environ 2 mois ago

Solved

Circumscribed circles

Given the lengths of the 3 sides of a triangle, output the radius of the circumscribed circle. Example: [3 4 5] -> 2.5

environ 2 mois ago

Solved

Basic electricity in a dry situation

⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ ⚡ &#...

environ 2 mois ago

Solved

Back to basics 12 - Input Arguments

Covering some basic topics I haven't seen elsewhere on Cody. Return a value equal to the number of input arguments to the fun...

environ 2 mois ago

Solved

Change matrix to vector

Vector is a matrix whose size is 1 x n or n x 1. Change matrix to vector. x = 4 3 5 1 ...

environ 2 mois ago

Solved

given number is power of n or not?

Check weather The input is power of n or not? for example x=8,n=2 --> true x=6,n=2 --> false

environ 2 mois ago