Crate a vector of logarithmically spaced
Create a vector of logarithmically spaced from 10^0 to 10^x with n sample
Example: if x=4 and n=3
Answer must be=[1 100 10...
arithmetic progression
I've written a program to generate the first few terms of <https://en.wikipedia.org/wiki/Arithmetic_progression arithmetic progr...
約4年 前
解決済み
Array GCD
* Find Greatest Common Divisor in a given array
* Function Template:
function ans = arraygcd(a)
% a=[45 15 200 ...
約4年 前
解決済み
Matrix rotation as per given angle
Given a user defined matrix and angle of rotation, rotate the elements of output matrix as clockwise or anti-clockwise. Angle wi...
約4年 前
解決済み
Cumulative difference
Given an array, return the cumulative difference.
Example
a = [ 1 3 5 7 ]
cumdiff = [ 1 2 1 -2 ]
Draw a triangle of ones
For any given n, return a matrix that includes a triangle of ones of height n:
Example
n = 3
output = [0,0,1,0,0
...
約4年 前
解決済み
Energy of an object
Calculate the total mechanical energy of an object.
Total Energy= Potential energy + Kinetic energy
P.E.=m*g*h
K.E.=1/2...
約4年 前
解決済み
Find all prime factors of the input
Given an input x, find its all prime factors. Return the vector with all factors in ascending order.
Efficiency is the key here...