回答済み
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))

7年弱 前 | 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...

7年弱 前 | 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...

7年弱 前 | 7

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

7年弱 前 | 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)...

7年弱 前 | 1

| 採用済み

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

7年弱 前 | 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...

7年弱 前 | 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 + ...

7年弱 前

解決済み


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

7年弱 前

解決済み


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

7年弱 前

解決済み


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

7年弱 前

解決済み


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

7年弱 前

解決済み


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

7年弱 前

解決済み


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

7年弱 前

解決済み


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

7年弱 前

解決済み


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

7年弱 前

解決済み


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

7年弱 前

解決済み


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

7年弱 前

解決済み


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

7年弱 前

解決済み


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

7年弱 前

解決済み


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

7年弱 前

解決済み


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

7年弱 前

解決済み


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

7年弱 前

解決済み


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

7年弱 前

解決済み


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

7年弱 前

解決済み


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

7年弱 前

回答済み
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...

7年弱 前 | 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)

7年弱 前 | 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];

7年弱 前 | 1

| 採用済み

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

7年弱 前 | 0

| 採用済み

さらに読み込む