已回答
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))

6 years 前 | 1

| 已接受

已回答
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...

6 years 前 | 1

| 已接受

已回答
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...

6 years 前 | 7

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

6 years 前 | 0

已回答
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)...

6 years 前 | 1

| 已接受

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

6 years 前 | 1

| 已接受

已回答
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...

6 years 前 | 0

| 已接受

已解决


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

6 years 前

已解决


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

6 years 前

已解决


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

6 years 前

已解决


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

6 years 前

已解决


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

6 years 前

已解决


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

6 years 前

已解决


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

6 years 前

已解决


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

6 years 前

已解决


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

6 years 前

已解决


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

6 years 前

已解决


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

6 years 前

已解决


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

6 years 前

已解决


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

6 years 前

已解决


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

6 years 前

已解决


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

6 years 前

已解决


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

6 years 前

已解决


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

6 years 前

已解决


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

6 years 前

已解决


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

6 years 前

已回答
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...

6 years 前 | 0

已回答
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)

6 years 前 | 0

已回答
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];

6 years 前 | 1

| 已接受

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

6 years 前 | 0

| 已接受

加载更多