Risposto
How to plot sine graph by using for loop?
You don't need a loop, just: theta = 0:0.1:2*pi; plot(theta,sin(theta))

circa 7 anni fa | 1

| accettato

Risposto
Result producing 1x5 array instead of 10x5?
You need to specify the index: n = 10; result = zeros(n,5); for k=1:n; A0=1;P0=29;g=rand;p=rand;B=rand; result(k,:) = [A0,P...

circa 7 anni fa | 1

| accettato

Risposto
Given a matrix "A", how to create a row vector of 1s that has the same number of elements as "A" has rows?
I think the goal of this forum is not to do anyone's homework, but to solve generic questions about Matlab that can help more us...

circa 7 anni fa | 7

Risposto
Not enough input arguments?
In this line: broyden(x,F,7,0.001); you are calling the function F without inputs!

circa 7 anni fa | 0

Risposto
Error for mismatched delimiters in relative long equation.
I guess you are missing a product(*) eqn = ((xr(1-q))/k - r(1- (x(1-q))/k)-1)*((log(xq+1))-q*q/c) + ((r(1-(x(1-q))/k)+1)*((1-q)...

circa 7 anni fa | 1

| accettato

Risposto
combine two Matrix in one column
L = [reshape(A',[numel(A),1]);reshape(B',[numel(B),1])]

circa 7 anni fa | 1

| accettato

Risposto
Averaging values in column 2 if column 1 falls within a certain range
Try this (just changing by your real B): n = 1:60; B = rand(1000,2); B(:,1) = linspace(1,60,1000); means = arrayfun(@(i) m...

circa 7 anni fa | 0

| accettato

Risolto


Summing digits
Given n, find the sum of the digits that make up 2^n. Example: Input n = 7 Output b = 11 since 2^7 = 128, and 1 + ...

circa 7 anni 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...

circa 7 anni fa

Risolto


Find all elements less than 0 or greater than 10 and replace them with NaN
Given an input vector x, find all elements of x less than 0 or greater than 10 and replace them with NaN. Example: Input ...

circa 7 anni fa

Risolto


Find the numeric mean of the prime numbers in a matrix.
There will always be at least one prime in the matrix. Example: Input in = [ 8 3 5 9 ] Output out is 4...

circa 7 anni 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...

circa 7 anni fa

Risolto


Determine whether a vector is monotonically increasing
Return true if the elements of the input vector increase monotonically (i.e. each element is larger than the previous). Return f...

circa 7 anni fa

Risolto


Who Has the Most Change?
You have a matrix for which each row is a person and the columns represent the number of quarters, nickels, dimes, and pennies t...

circa 7 anni fa

Risolto


Add two numbers
Given a and b, return the sum a+b in c.

circa 7 anni fa

Risolto


Select every other element of a vector
Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

circa 7 anni fa

Risolto


Triangle Numbers
Triangle numbers are the sums of successive integers. So 6 is a triangle number because 6 = 1 + 2 + 3 which can be displa...

circa 7 anni fa

Risolto


Make a checkerboard matrix
Given an integer n, make an n-by-n matrix made up of alternating ones and zeros as shown below. The a(1,1) should be 1. Examp...

circa 7 anni fa

Risolto


Find the sum of all the numbers of the input vector
Find the sum of all the numbers of the input vector x. Examples: Input x = [1 2 3 5] Output y is 11 Input x ...

circa 7 anni fa

Risolto


Remove the two elements next to NaN value
The aim is to *remove the two elements next to NaN values* inside a vector. For example: x = [6 10 5 8 9 NaN 23 9 7 3 21 ...

circa 7 anni fa

Risolto


Times 2 - START HERE
Try out this test problem first. Given the variable x as your input, multiply it by two and put the result in y. Examples:...

circa 7 anni fa

Risolto


Extract leading non-zero digit
<http://en.wikipedia.org/wiki/Benford%27s_law Benford's Law> states that the distribution of leading digits is not random. This...

circa 7 anni fa

Risolto


Make a Palindrome Number
Some numbers like 323 are palindromes. Other numbers like 124 are not. But look what happens when we add that number to a revers...

circa 7 anni fa

Risolto


Most nonzero elements in row
Given the matrix a, return the index r of the row with the most nonzero elements. Assume there will always be exactly one row th...

circa 7 anni fa

Risolto


Flip the main diagonal of a matrix
Given a n x n matrix, M, flip its main diagonal. Example: >> M=magic(5); >> flipDiagonal(M) 9 24 1 ...

circa 7 anni fa

Risolto


Determine if input is odd
Given the input n, return true if n is odd or false if n is even.

circa 7 anni fa

Risposto
Consider a signal ?[?] = (0.2)??[?]. plot the magnitude, angle, real and imaginary parts of ?(???). Plot ?(???) at 101 101 equispaced points between 0 and ?. help me to find error in subplot command. all four items are not plotted.
Your problem is due to bad programming practices. I recommend to put each instruction in a separate line. If you do that your sc...

circa 7 anni fa | 0

Risposto
How to change this function fun = @(x)x(1)*exp(-norm(x)^2) to x^2+y^2?
fun = @(x) (x(1)^2 + x(2)^2) %x(1) is x and x(2) is y %or fun = @(x,y) (x^2 + y^2)

circa 7 anni fa | 0

Risposto
How can I append same size matrix vertically?
sample = [12 62; 93 -8; -1, 11]; sample2 = [10 60; 90 0; 0, 10]; new = [sample; sample2];

circa 7 anni fa | 1

| accettato

Risposto
Sum of rows in a defined rhythm
A(1:5*270,1)=1; B(1:270,1) = sum(A(270:270:end,1))

circa 7 anni fa | 0

| accettato

Carica altro