Solved


Tricky timing
Write a function that takes between 0.5 seconds and 0.6 seconds to run.

13 years ago

Solved


2 b | ~ 2 b
Given a string input, output true if there are 2 b's in it, false if otherwise Examples: 'Macbeth' -> false 'Publius Cor...

13 years ago

Solved


Back to basics 23 - Triangular matrix
Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, return a matrix with all elements above a...

13 years ago

Solved


Sum of diagonal of a square matrix
If x = [1 2 4; 3 4 5; 5 6 7] then y should be the sum of the diagonals of the matrix y = 1 + 4 + 7 = 12

13 years ago

Answered
Copying non zero matrix to a zeros matrix
a = magic(3); padarray(a,[2 1]) ans = 0 0 0 0 0 0 0 0 0 0 0 ...

13 years ago | 1

| accepted

Answered
Solving Systems of Linear Equations
does this answer help? http://www.mathworks.com/matlabcentral/answers/24086-ols-regression-for-multiplr-ys-xs

13 years ago | 0

Answered
generate random number GG distribution in matlab
r = randn(100,1) % 100 samples

13 years ago | 0

Answered
sorting a matrix in descending order
sort(group,1,'descend')

13 years ago | 0

Answered
Least square fit.
change line 81 to read plot(x1,y,'r*-'),grid on; by the way, a is more efficiently calculated as a = k\y;

13 years ago | 0

Answered
How to find variance
unless I misunderstand your question, 95% is 1.96 standard deviations (two sided). You didn't mention if the 10 pixels are ±, s...

13 years ago | 0

Answered
Lagrange Multipliers
here is a nudge to solving your problem syms x y L d = ??? % for you to fill out; distance from (-1,...

13 years ago | 0

| accepted

Answered
Working with polynoms
syms s >> expand((s+4)*(s+0.5-0.2*i)*(s+0.5+0.2*i)) ans = s^3 + 5*s^2 + (429*s)/100 + 29/25 >> fac...

13 years ago | 2

| accepted

Answered
finding distance from text data for latitude/longitude and creating new column of data for distance
the diff() function will calculate the difference for you without a loop. Here is a start: loc = [51.8885857 -2.15981330...

13 years ago | 0

| accepted

Answered
Finding zeros of an equation
if you *insist* on using a subfunction , consider the following: function x = myroots(y) % y is an integer range to find...

13 years ago | 0

Answered
Using a loop to find out how long and how many terms
Check your math clc;clear dep = 10000; account = 10000; year = 0; while account < 1000000 year =...

13 years ago | 2

| accepted

Answered
Need to make a 4D plot (3D + Colour)
have a look at slice()

13 years ago | 0

Answered
Finding zeros of an equation
doc roots

13 years ago | 0

Answered
OVERLAY POINTS IN A MAP
simple example plots 3 sondes off the coast of the North America c = load('cape'); spy(c.X==1) hold plot([300,250,200],[...

13 years ago | 0

| accepted

Answered
problem with double integral, dblquad and quad2d
Use the matlabFunction() to change the symbolic equation to something dblquad can evaluate: f = matlabFunction(Easil) ...

13 years ago | 0

Answered
quadl problem (Matrix dimensions must agree.).
You probably have to fully vectorize your calculations: .* % for multiply ./ % for divide .^ % for power

13 years ago | 0

| accepted

Answered
find distance between random points.
hypot(x,y)

13 years ago | 0

Solved


Filter AC, pass DC
Input x is the sampled signal vector, may have both AC and DC components. Output vector y should not contain any AC component. ...

13 years ago

Solved


Back to basics 11 - Max Integer
Covering some basic topics I haven't seen elsewhere on Cody. Return the largest positive integer MATLAB can handle.

13 years ago

Solved


Remove NaN ?
input -> matrix (n*m) with at least one element equal to NaN; output -> matrix(p*m), the same matrix where we deleted the enti...

13 years ago

Solved


Find common elements in matrix rows
Given a matrix, find all elements that exist in every row. For example, given A = 1 2 3 5 9 2 5 9 3 2 5 9 ...

13 years ago

Answered
How to remove ticks from the x-axis?
set(gca,'XTick',[])

13 years ago | 5

| accepted

Solved


Find the two most distant points
Given a collection of points, return the indices of the rows that contain the two points most distant from one another. The inpu...

13 years ago

Solved


Solve the Sudoku Row
*Description* A simple yet tedious task occurs near the end of most Sudoku-solving algorithms, computerized or manual. The ta...

13 years ago

Solved


Test for balanced parentheses
Given the input inStr, give the boolean output out indicating whether all the parentheses are balanced. Examples: * If ...

13 years ago

Load more