Create matrix of replicated elements
Given an input element x, and the dimensions, (m, n) return a matrix of size m x n filled with element x.
Example:
Input: ...
2 years 前
已解决
Create sequnce 1 4 9 16 25.........
Create sequnce 1 4 9 16 25......... upto entered input value using matlab scripting commands. Let y be output and x be input
Reindex a vector
You are given two vectors of equal length. Vector N has numeric values (no Inf or NaN) while vector IDX has integers. Place th...
2 years 前
已解决
Find nth maximum
Find nth maximum in a vector of integer numbers. Return NaN if no such number exists.
x = [2 6 4 9 -10 3 1 5 -10];
So
...
2 years 前
已解决
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 前
已解决
Matlab Basics - Logical Tests I
Write a script to test whether a year number is for a leap year or not.
eg. x = 1884
output = 1
eg. x = 3
output = 0
2 years 前
已解决
Sum the squares of numbers from 1 to n
For a given value of n return the sum of square of numbers from 1 to n.
Example
For n = 2
then sum of squares = 5 (1^2 + ...
Matlab Basics - Switching Assignments
Switch assignments for variables x and y, for example
start with x = 1 and y = 3
end with y = 1 and x = 3
Do NOT simply r...
2 years 前
已解决
Right and wrong
Given a vector of lengths [a b c], determines whether a triangle with those sides lengths is a right triangle: <http://en.wikipe...
2 years 前
已解决
Count ones
Write a program to count number of ones (1s) in an integer variable input.
For example:
Input x=2200112231
output y=3
I...
2 years 前
已解决
Product of Array
Given an array of numbers. Get the product of the array.