Community Profile

Last seen: 6 giorni fa Attivo dal 2021

All

#### Content Feed

Visto da

Risolto

Create a cell array out of a struct
Create a cell array out of a (single) struct with the fieldname in the first column and the value in the second column: in: ...

circa 2 mesi fa

Risolto

Fix the last element of a cell array
Note: this is lifted directly from <http://www.mathworks.com/matlabcentral/answers/82825-puzzler-for-a-monday Puzzler for a Mond...

circa 2 mesi fa

Risolto

Natural numbers in string form
Create a cell array of strings containing the first n natural numbers. _Slightly_ harder than it seems like it should be. Ex...

2 mesi fa

Risolto

Convert a numerical matrix into a cell array of strings
Given a numerical matrix, output a *cell array of string*. For example: if input = 1:3 output is {'1','2','3'} whic...

2 mesi fa

Risolto

Convert a Cell Array into an Array
Given a square cell array: x = {'01', '56'; '234', '789'}; return a single character array: y = '0123456789'

2 mesi fa

Risolto

Split a string into chunks of specified length
Given a string and a vector of integers, break the string into chunks whose lengths are given by the elements of the vector. Ex...

2 mesi fa

Domanda

Write a function max_sum that takes v a row vector of numbers & n,a positive integer as inputs.The function needs to find n consecutive elements of v whose sum is largest poss
I write this code for the qst in desciption function [summa,index] = max_sum(v,n) l=length(v); if n>length(v) summa =0...

3 mesi fa | 0 risposte | 0

### 0

risposte

Risolto

Sum of series IV
What is the sum of the following sequence: Σ(-1)^(k+1) (2k-1)^2 for k=1...n for different n?

6 mesi fa

Risolto

Sum of series III
What is the sum of the following sequence: Σ(2k-1)^3 for k=1...n for different n?

6 mesi fa

Risolto

Sum of series II
What is the sum of the following sequence: Σ(2k-1)^2 for k=1...n for different n?

6 mesi fa

Risolto

Sum of series I
What is the sum of the following sequence: Σ(2k-1) for k=1...n for different n?

6 mesi fa

Risolto

Make a random, non-repeating vector.
This is a basic MATLAB operation. It is for instructional purposes. --- If you want to get a random permutation of integer...

9 mesi fa

Risolto

Swap the first and last columns
Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becomes the first. All oth...

9 mesi fa

Risolto

Swap the input arguments
Write a two-input, two-output function that swaps its two input arguments. For example: [q,r] = swap(5,10) returns q = ...

9 mesi fa

Risolto

Check if number exists in vector
Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

9 mesi fa

Risolto

Project Euler: Problem 10, Sum of Primes
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below the input, N. Thank you <http:/...

10 mesi fa

Domanda

name value pairs with variable input arguments
function db = name_value_pairs(varargin) n=length(varargin); db ={}; if mod(n,2)~=0 || n ==0 db= {}; elseif ~ischar(var...

10 mesi fa | 1 risposta | 0

### 1

risposta

Risolto

Project Euler: Problem 7, Nth prime
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the Nth prime nu...

10 mesi fa

Risolto

Project Euler: Problem 6, Natural numbers, squares and sums.
The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ...

10 mesi fa

Risolto

Return fibonacci sequence do not use loop and condition
Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: ...

10 mesi fa

Risolto

Integer Sequence - II : New Fibonacci
Crack the following Integer Sequence. (Hints : It has been obtained from original Fibonacci Sequence and all the terms are also ...

10 mesi fa

Risolto

Return the Fibonacci Sequence
Write a code which returns the Fibonacci Sequence such that the largest value in the sequence is less than the input integer N. ...

10 mesi fa

Risolto

Fibonacci sequence
Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: Inpu...

10 mesi fa

Risolto

Create an n-by-n null matrix and fill with ones certain positions
The positions will be indicated by a z-by-2 matrix. Each row in this z-by-2 matrix will have the row and column in which a 1 has...

10 mesi fa

Risolto

Find max
Find the maximum value of a given vector or matrix.

10 mesi fa

Risolto

Get the length of a given vector
Given a vector x, the output y should equal the length of x.

10 mesi fa

Risolto

Whether the input is vector?
Given the input x, return 1 if x is vector or else 0.

10 mesi fa

Risolto

Flip the vector from right to left
Flip the vector from right to left. Examples x=[1:5], then y=[5 4 3 2 1] x=[1 4 6], then y=[6 4 1]; Request not ...

10 mesi fa

Risolto

Roll the Dice!
*Description* Return two random integers between 1 and 6, inclusive, to simulate rolling 2 dice. *Example* [x1,x2] =...

10 mesi fa

Risolto

Sum all integers from 1 to 2^n
Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.

10 mesi fa