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
5年以上 前
解決済み
Remove all the words that end with "ain"
Given the string s1, return the string s2 with the target characters removed.
For example, given
s1 = 'the main event'
your ...
Mode
Find the mode of the vector
Assumption: no vector is bimodal
Example 1: input=[1 2 3 4 4]; output=4
Example 2: input=[7...
5年以上 前
解決済み
Odd times even numbers in a matrix
First count the number of odd numbers in x, then the number of even. Return their product.
example:
x = [1 2]
One odd ...
5年以上 前
解決済み
Reshape a Vector
Write a function that accept three inputs. The first one is a row vector S. The
second and third arguments are m and n which de...
5年以上 前
解決済み
Replace 0 to NaN!
In given matrix
A=[1 nan nan; 2 2 nan; nan nan 1];
replace NaN to 0. Use matrix A as a input.
5年以上 前
解決済み
Find x in provided equation!
x^2-2*x+1=0
This polynomial can be expressed by using each term's coefficients, such as
[1 -2 1].
Using the polynomial ...
Vector with a repeated entry
Create a row vector of length n, filled with 4's. For example, if n = 3,
output = [4 4 4]
Hint:
Search for the function...
Temperature conversion
Convert temperature in degrees Celsius (C) to temperature in degrees Kelvin (K). Assume your answer is rounded to the nearest Ke...