已回答
How to use global variables inside a function?
First you need to define a variable say x as global global x x=5 Then in the function definition which is using the glo...

6 years 前 | 20

已解决


Return elements unique to either input
Given two numeric inputs a and b, return a row vector that contains the numbers found in only a or only b, but not both. For ex...

6 years 前

已解决


Spot the outlier
All points except for one lie on a line. Which one is the outlier? Example: You are given a list of x-y pairs in a column ...

6 years 前

已解决


Return unique values without sorting
If the input vector A is [42 1 1], the output value B must be the unique values [42 1] The *values of B are in the s...

6 years 前

已解决


Find the largest value in the 3D matrix
Given a 3D matrix A, find the largest value. Example >> A = 1:9; >> A = reshape(A,[3 1 3]); >> islargest(A) a...

6 years 前

已解决


Specific Element Count
Given a vector _v_ and a element _e_, return the number of occurrences of _e_ in _v_. Note: NaNs are equal and there may be n...

6 years 前

已解决


Check if number exists in vector
Return 1 if number _a_ exists in vector _b_ otherwise return 0. a = 3; b = [1,2,4]; Returns 0. a = 3; b = [1,...

6 years 前

已解决


How many trades represent all the profit?
Given a list of results from trades made: [1 3 -4 2 -1 2 3] We can add them up to see this series of trades made a profit ...

6 years 前

已回答
Not enough input arguments
The code you have written is correct all that you need to do is to define the variable P after you have defined the value of A,B...

6 years 前 | 0

已解决


Generate N equally spaced intervals between -L and L
Given N and L, return a list of numbers (in ascending order) that divides the interval [-L L] into N equal-length segments. F...

6 years 前

已解决


Find a subset that divides the vector into equal halves
Given a vector x, return the indices to elements that will sum to exactly half of the sum of all elements. Example: Inpu...

6 years 前

已回答
How to solve x^4-p*x+q.solve for x considering p and q as constants
Here is a better way to implement when you only have the equation given syms x %define the value of p and q y=x^4-p*x+q;...

6 years 前 | 0

已回答
How to set domain for p(x)/q(x) functions?
You could just use this simple code instead syms x y=(x-1)/(x-2) ezplot(y)

6 years 前 | 0

已回答
How to plot this equation in 3D?
You could use the following code syms x y z = ((1/x)^2 +y^2)^(1/2) ezsurf(z)

6 years 前 | 0

已解决


Find the peak 3n+1 sequence value
A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

6 years 前

已解决


Return the Fibonacci Sequence
Write a code which returns the Fibonacci Sequence such that the largest value in the sequence is less than the input integer N. ...

6 years 前

已解决


Which values occur exactly three times?
Return a list of all values (sorted smallest to largest) that appear exactly three times in the input vector x. So if x = [1 2...

6 years 前

已解决


Interpolator
You have a two vectors, a and b. They are monotonic and the same length. Given a value, va, where va is between a(1) and a(end...

6 years 前

已解决


Maximum running product for a string of numbers
Given a string s representing a list of numbers, find the five consecutive numbers that multiply to form the largest number. Spe...

6 years 前

已回答
How to solve the following equations for vc(t)?
Try the following syms t; T=((vc-Vin)/Rc)*Tsw/2*1/(1.5*Il-0.5*Ipo); vc=(291*cos((6339586188837495*t)/137438953472)*exp(-...

6 years 前 | 1

| 已接受

已解决


How long is the longest prime diagonal?
Stanislaw Ulam once observed that if the counting numbers are <http://en.wikipedia.org/wiki/Ulam_spiral arranged in a spiral>, t...

6 years 前

已回答
Failure in initial objective function evaluation. FSOLVE cannot continue
I guess the mistake you are making is in using Tee = x(1); Cee = x(2); Rather it should be Tee = x0(1); Cee = x0(2)...

6 years 前 | 0

已解决


Alternating sum
Given vector x, calculate the alternating sum y = x(1) - x(2) + x(3) - x(4) + ...

6 years 前

已解决


Replace NaNs with the number that appears to its left in the row.
Replace NaNs with the number that appears to its left in the row. If there are more than one consecutive NaNs, they should all ...

6 years 前

已解决


Remove any row in which a NaN appears
Given the matrix A, return B in which all the rows that have one or more <http://www.mathworks.com/help/techdoc/ref/nan.html NaN...

6 years 前

已回答
Y(n)=5x(n-5)-3x(n 4)
I guess this is probably what you are looking for syms x n x(n)={1,2,3,4,5,6,7,6,5,4,3,2,1} x1(n)=5*x(n-5)-3*x(n+4) x...

6 years 前 | 0

已回答
MATLAB program to find the roots of an equation
Instead of using fsolve try using vpasolve syms x c=0.2:0.1:2; y=cos(x)-c*x; for i=1:numel(y) sol(i)=vpasolve(y(i),...

6 years 前 | 1

| 已接受

已解决


Find the longest sequence of 1's in a binary sequence.
Given a string such as s = '011110010000000100010111' find the length of the longest string of consecutive 1's. In this examp...

6 years 前

已解决


Reverse Run-Length Encoder
Given a "counting sequence" vector x, construct the original sequence y. A counting sequence is formed by "counting" the entrie...

6 years 前

已解决


Trimming Spaces
Given a string, remove all leading and trailing spaces (where space is defined as ASCII 32). Input a = ' singular value deco...

6 years 前

加载更多