Respondida
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))

más de 7 años hace | 1

| aceptada

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

más de 7 años hace | 1

| aceptada

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

más de 7 años hace | 7

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

más de 7 años hace | 0

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

más de 7 años hace | 1

| aceptada

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

más de 7 años hace | 1

| aceptada

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

más de 7 años hace | 0

| aceptada

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

Resuelto


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

más de 7 años hace

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

más de 7 años hace | 0

Respondida
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)

más de 7 años hace | 0

Respondida
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];

más de 7 años hace | 1

| aceptada

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

más de 7 años hace | 0

| aceptada

Cargar más