Answered

How to vectorize for loop of partial arrays?

Hi, this is a vectorized version of your loop. k = ones(1000,1); b = 10*rand(25,1); f = ones(25,1); a = 10*rand...

How to vectorize for loop of partial arrays?

Hi, this is a vectorized version of your loop. k = ones(1000,1); b = 10*rand(25,1); f = ones(25,1); a = 10*rand...

environ 5 ans ago | 0

Answered

How can I delete numbers in a matrix that is not equal to numbers in another matrix?

Hi, you can use logical indexing with the 'ismember' function: A= A(ismember(A,B))

How can I delete numbers in a matrix that is not equal to numbers in another matrix?

Hi, you can use logical indexing with the 'ismember' function: A= A(ismember(A,B))

environ 5 ans ago | 1

Answered

How can I calculate the product of elements in even positions in a vector using a for loop, without using sum or prod built-in functions?

Hi, you can use the modulo function to detect the even positions and then simply multiply the values. z = (50)*rand(1,100...

How can I calculate the product of elements in even positions in a vector using a for loop, without using sum or prod built-in functions?

Hi, you can use the modulo function to detect the even positions and then simply multiply the values. z = (50)*rand(1,100...

environ 5 ans ago | 0

Answered

Out of memory error with 8GB and 64bit

Hi, considering the mentioned size of a matrix, the matrix would occupy ~20GB or ~10GB in the case of single precision. With ...

Out of memory error with 8GB and 64bit

Hi, considering the mentioned size of a matrix, the matrix would occupy ~20GB or ~10GB in the case of single precision. With ...

environ 5 ans ago | 0

| accepted

Answered

Comparing more than two columns of a matrix using '<' or '>' symbol

Hi, you can achieve this by using B = diff(-A,1,2) < 0 You have to concatenate a column of zeros, so that A and B are ...

Comparing more than two columns of a matrix using '<' or '>' symbol

Hi, you can achieve this by using B = diff(-A,1,2) < 0 You have to concatenate a column of zeros, so that A and B are ...

environ 5 ans ago | 0

Answered

If statement with 2 matrices

Hi, if statements on matrices can often be realized with logical indexing. Assuming the matrix B is of type 'logical', your ...

If statement with 2 matrices

Hi, if statements on matrices can often be realized with logical indexing. Assuming the matrix B is of type 'logical', your ...

environ 5 ans ago | 0

| accepted

Answered

Why complex arrays take twice as much memory on GPU than on CPU ?

Hi, this behaviour is not a difference between CPU and GPU. It is the general case that the complex nuber uses twice the memo...

Why complex arrays take twice as much memory on GPU than on CPU ?

Hi, this behaviour is not a difference between CPU and GPU. It is the general case that the complex nuber uses twice the memo...

environ 5 ans ago | 0

Answered

Plotting data on a 2d plane with colorbar

Hi, an easy way of doing this is the scatter plot. Use it like this scatter(x,y,[],z,'filled') <</matlabcentral/answe...

Plotting data on a 2d plane with colorbar

Hi, an easy way of doing this is the scatter plot. Use it like this scatter(x,y,[],z,'filled') <</matlabcentral/answe...

environ 5 ans ago | 2

Solved

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 + ...

environ 5 ans ago

Answered

In an assignment A(I) = B, the number of elements in B and I must be the same.

Hi, your problem is, that the dimensions of Rainfall and CN don't match. Use the the index idx or ~idx on CN. Also the operat...

In an assignment A(I) = B, the number of elements in B and I must be the same.

Hi, your problem is, that the dimensions of Rainfall and CN don't match. Use the the index idx or ~idx on CN. Also the operat...

environ 5 ans ago | 0

| accepted

Solved

Health app

A health app records a user's weight and displays the change in weight from the previous measurement to the next. Assign weightC...

plus de 5 ans ago

Solved

Writing a while loop

Write a while loop that continues to increment userValue by 5 until userValue is less than 0.

plus de 5 ans ago

Solved

Preset rpm speeds

A centrifuge has four preset speeds. Write a switch statement that assigns rpmSetting with the appropriate rpm speed given prese...

plus de 5 ans ago

Solved

Vigenere cipher - be like Sherlock Holmes!

You're a young detective. Every detective needs a function to decrypt a vigenère cipher. It's a modification of a caesar cipher....

plus de 5 ans ago

Solved

Is my wife right

This is question relies on the dilemma that every married man faces in his life. Which has one simple ans: So whatever the qu...

plus de 5 ans ago

Solved

Calculate Simple Intrest for given data

P,N,R stands for Principle amount, No. of years and rate of intrest resp. Calculate intrest I

plus de 5 ans ago

Solved

Remove All elements less than 5

Given an input vector x, remove all elements of x less than 5 . Example: Input x = [ 1 2 5 7 3 ] Output y is [ 5 7 ...

plus de 5 ans ago

Answered

How it is possible to sum these two matrix as a vector?

If I understand you right, this should do it. function [C1,C2] = foo(A,B) C1 = zeros(16,4); C2 = zeros(16,4); i...

How it is possible to sum these two matrix as a vector?

If I understand you right, this should do it. function [C1,C2] = foo(A,B) C1 = zeros(16,4); C2 = zeros(16,4); i...

plus de 5 ans ago | 0

| accepted

Solved

What is the next step in Conway's Life?

Given a matrix A that represents the state of <http://en.wikipedia.org/wiki/Conway's_Game_of_Life Conway's game of Life> at one ...

plus de 5 ans ago

Solved

Interpolator

You have a two vectors, a and b. They are monotonic and the same length. Given a value, va, where va is between a(1) and a(end...

plus de 5 ans ago

Solved

Counting in Finnish

Sort a vector of single digit whole numbers alphabetically by their name, in Finnish. See the Wikipedia page for <http://en.wik...

plus de 5 ans ago

Solved

radius of a spherical planet

you just measured its surface area, that is the input.

plus de 5 ans ago

Answered

plot a certain x,y values from a large matrix

You can use the colon operator to select a subset of your vector, like plot(x(500:2500),y(500:2500))

plot a certain x,y values from a large matrix

You can use the colon operator to select a subset of your vector, like plot(x(500:2500),y(500:2500))

plus de 5 ans ago | 0

Solved

Remove all the consonants

Remove all the consonants in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill'; Output s2 is 'a ...

plus de 5 ans ago

Solved

How to find the position of an element in a vector without using the find function

Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...

plus de 5 ans ago

Solved

Is it column vector?

Is it column vector? Check vector for column vector without using iscolumn function.

plus de 5 ans ago

Solved

replace empty matrices with '[]'

for example a=1;a(:,1)=[]; returns a = Empty matrix: 1-by-0 use this as the input,and the output should be '[]...

plus de 5 ans ago