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

mehr als 7 Jahre vor | 1

| akzeptiert

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

mehr als 7 Jahre vor | 1

| akzeptiert

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

mehr als 7 Jahre vor | 7

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

mehr als 7 Jahre vor | 0

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

mehr als 7 Jahre vor | 1

| akzeptiert

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

mehr als 7 Jahre vor | 1

| akzeptiert

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

mehr als 7 Jahre vor | 0

| akzeptiert

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

Gelöst


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

mehr als 7 Jahre vor

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

mehr als 7 Jahre vor | 0

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

mehr als 7 Jahre vor | 0

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

mehr als 7 Jahre vor | 1

| akzeptiert

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

mehr als 7 Jahre vor | 0

| akzeptiert

Mehr laden