Solved


Calculate roots of polynomial given as vector array.
Calculate roots of polynomial given as vector array. Example x=[1 2 0 5 0 3] result=[-2.7267 ; ...

10 years ago

Solved


Find scalar product of two polynomials a and b, given as vector array.
Find scalar product of two polynomials given as vector array. Example a=[1 -1 2]; b=[2 4 1]; result=0

10 years ago

Solved


Return amount of palindromes in the string.
Example Input: s='eye story pop dictionary noon enjoy software moon' Output: amount=3

10 years ago

Solved


Counting candies
In a classroom of |'n'| children, every even numbered child gets one big candy and every odd numbered child gets two small candi...

10 years ago

Solved


Find Euclidean norm of given vector u.
Find Euclidean norm of given vector u. https://en.wikipedia.org/wiki/Euclidean_distance Example x=[1 1] result=sqrt(1^2+1^2...

10 years ago

Solved


Find cosine between two given vectors u and v.
Find cosine between two given vectors u and v. Example u = [5 2 0 5 3 0]; v = [3 2 5 1 ...

10 years ago

Solved


Numerate input arguments
For every input, output the number. Example: [a, b] = Test('first', 'second') a=1; b=2;

10 years ago

Solved


Calculate the eigenvalues of A.
Calculate the sum of the eigenvalues of A. If it's odd return cubed else return 54.

10 years ago

Solved


Find product of eigenvalues of n*n magic matrix.
Find product of eigenvalues of n*n magic matrix. Example n=3 Matrix= [ 8 1 6; 3 5 7; 4 ...

10 years ago

Solved


Find the product of the positive elements above the main diagonal.
Example Input A=[1 2; -3 0] Output 2

10 years ago

Solved


Calculate the sum of elements of n*n Hilbert matrix.
Calculate the sum of elements of n*n Hilbert matrix. Example n=5 HilbertMatrix=[1.0000 0.5000 0.3333 0.2500 ...

10 years ago

Solved


For given vectors x,y find coresponding spline coefficients.
For given vectors x,y find coresponding spline coefficients. Example x =[ -3 -2 0 2 3] y =[ 0 0 1 ...

10 years ago

Solved


Get linearly independent vectors of given matrix.
Get linearly independent vectors of given matrix. Example matrix=[ 3 -1 0 0 ; 0 3 0 0...

10 years ago

Solved


Calculate the centroid of a triangle
Info: https://en.wikipedia.org/wiki/Centroid Example Input: x = [0 0 1]; % x-coordinate y = [0 1 0]; % y-coordinat...

10 years ago

Solved


Square root of a number
Write a code that will output the square root of x.

10 years ago

Solved


What's size of TV?
Many people buy TV. Usually they ask about diagonal. But also important are width and height. Let's assume that all TV have rati...

10 years ago

Solved


isnan()
Replace all nans with zeros

10 years ago

Answered
How do I generate a random number between two numbers, "n" number of times?
Without using a for-loop: a = 0; b = 255; n = 1000; x = a + (b-a).*rand(n,1); will generate n numbers randomly ...

10 years ago | 1

Answered
Plotting the data if all the data point is to be represented by a vertical bar from the x-axis (y=0) to the value of y for that point
y = randi(10,1,10); % generate random data figure; hold on; for ii=1:length(y) plot([ii ii],[0 y(ii)],'b'); e...

10 years ago | 1

| accepted

Answered
Help converting cell to matrix of doubles (Large matrix)
I think datevec is what you want. d = datevec(data(:,1),'yyyy-mm-dd'); d = d(:,1:3); % if you only want to keep the year...

10 years ago | 0

| accepted

Answered
How do seperate a string in different strings while not creating new strings for variables
For diversity of answers, here is another option (although I do not claim it is better than other answers!): str = '# Donal...

10 years ago | 2

| accepted

Answered
Is there a way to reduce the precision of Matlab overall?
Here is a simple way to change the precision of a result: n = 4; % number of desired decimal points x = round(x*10^n)/10...

10 years ago | 1

Answered
Matlab delete's value's from array
Suppose you have an M-by-N matrix (A) of NaNs, 0s, and 1s: M = 3648; % number of rows N = 4; % number of columns A ...

10 years ago | 0

Answered
check if url exists for large files without downloading the file
It seems I stumbled upon a similar approach to Steven, but a few minutes too late! I think this function would do the trick: ...

10 years ago | 0

Answered
a matlab code of getting a value uniformly at random from a the set {-1,1}
To generate values uniformly from the set {-1,1}, use: N = 100; x = 2*(rand(N,1)>0.5)-1; where N is the number of val...

10 years ago | 2

Solved


calculate the day of the year from a date string.
'09-Oct-2016' is the 283rd day of the year. So doy = dayoftheyear('09-Oct-2016') should return doy = 283

10 years ago

Solved


Implement zero-based indexing for Matrices
Given an input vector and position (which is zero based) output the value Example: x = [1 2; 4 5] pos = [0 1] value = 5 ...

10 years ago

Solved


Triplicate me
Given an input vector, output a 3n vector with all elements of input vector repeated thrice Example : in->[1 2 3 5] out...

10 years ago

Solved


Calculate correlation.
There are two data. y1=[0 1 2 3 4]' y2=[2 3 4 5 6]' We can see positive relationship between y1 and y2. The relations...

10 years ago

Load more