Answered
Find Consecutive numbers and print value in next collumn
Simple loop works c=0; f(:,6)=0; for k=1:size(f,1) if f(k,5)==1 c=c+1; f(k,6)=c; else c=0; end end

5 years ago | 1

Answered
Check every element of an array with if statement
z = [0.2+(-500:.05:500)*1i]; R = (z-1)./(z+1); x = abs(R); idx=x<=1; plot(real(R(idx)),imag(R(idx)),'b'); title('R Pla...

5 years ago | 0

| accepted

Answered
Producing all combinations of a vector with replacement
[x,y]=meshgrid(1:4); z=unique(sort([x(:),y(:)],2),'rows');

5 years ago | 2

| accepted

Solved


Back to basics 13 - Input variables
Covering some basic topics I haven't seen elsewhere on Cody. Return as a string the name of the input variable to the functio...

5 years ago

Solved


Back to basics 4 - Search Path
Covering some basic topics I haven't seen elsewhere on Cody. Return a string that is the user's portion of the current search...

5 years ago

Solved


N-Cards Problem
You have a deck of _N_ cards numbered in order from 1 to _N_. You discard the top card (card 1) and place the next card (card 2)...

5 years ago

Solved


Determine if a Given Number is a Triangle Number
*Description:* Determine if the elements of an input array are triangle numbers and return the result as an array with the sa...

5 years ago

Answered
Cicle for read data.
for k=0:95 T= sprintf("M3%d.dat",k); M3{k+1}= readtable(T, opts);%must start indexing at 1 end

5 years ago | 0

| accepted

Answered
How do I solve the double integral r dr d theta from 0,pi/2 and 0,4
syms r theta a=int(int(r,'theta',0,pi/2),'r',0,4);

5 years ago | 1

| accepted

Answered
Problems in for loop with cell array
Why not just use fit() function x=0:.01:2*pi; y=(5+.05*randn(size(x))).*sin((3+.05*randn(size(x))).*x); f=fit(x',y','sin1'); ...

5 years ago | 0

| accepted

Answered
How do I solve the triple integral xz^2siny from 0,pi/2,0,pi/2,1,2?
syms x y z; eqn=x*z^2*sin(y); a=int(int(int(eqn,'x',0,pi/2),'y',0,pi/2),'z',1,2);

5 years ago | 0

Answered
HOW CAN I PLOT THIS?
load('EXAMPLE.mat'); m=table2array(GIULIAMMEQ1); d=datenum(m(:,1)); v=str2double(m(:,2)); idx=~isnan(v); plot(d(idx),v(idx)...

5 years ago | 0

Solved


Compute the effective conductivity of a heterogeneous aquifer
Slow flow through soil or another porous medium follows Darcy’s law, which relates the flow of water to the gradient in piezome...

5 years ago

Solved


Pick the die most likely to win
After discussing Rock, Paper, Scissors, Lizard, Spock in The Simpsons and their Mathematical Secrets, Simon Singh writes that in...

5 years ago

Solved


create a function that give us like the following
x=3 y= [1 -1 -1 0 1 -1 0 0 1]; -------------------------------- x=5 y= [ 1 -1 -...

5 years ago

Answered
I need to make groups from array
Some guessing. You only said it stays in group is greater by 1-5%, I assumed a new group otherwise. Anyways, you modify the belo...

5 years ago | 1

Answered
Arrange the values in a Matrix in a way (line by line)
F=reshape(G,5,4)';

5 years ago | 0

Solved


MATLAB Basics: Complex Numbers
For a given complex number, x, return the real and imaginary parts as a vector, y = [Real Imaginary].

5 years ago

Solved


MATLAB Basics: Complex Argument
For a given complex number, x, return the argument, y, in degrees.

5 years ago

Solved


MATLAB Basics: Complex Conjugates
For a given complex number, x, return the complex conjugate, y.

5 years ago

Solved


Compute the sum of reciprocals of quadratics
Write a function to compute the following sum: See also Cody Problem 46000.

5 years ago

Answered
How to deal with error "Input #3 expected to be a cell array, was double instead." using cellfun?
Loops are not bad. cellfun is performing a loop. Mb = {Mbx -Mbx Mby -Mby}; for k=1:4 [~,locs{k},~,~] = findpeaks(Mb{k},t,...

5 years ago | 0

Answered
i want to calculate the jacobian with known values of A B and V2, the answer should be 14 -4 0; -4 9 0; 0 0 14
syms A B D E F V2 P2 P3 Q3; P2=10*V2*sin(A)+4*V2*sin(A-B)+1.5; P3=5*sin(B)+4*sin(B-A)-1; Q3=-10*V2*cos(B)+14*(V2^2)-4*V2*cos...

5 years ago | 0

Answered
Hello everyone, anyone knows how to approximate a data with polynomial of degree 8 using least square method?
Use polyfit, place the x and y columns of your data into the function. p=polyfit(x,y,8);%you will need to convert time using da...

5 years ago | 0

Solved


Convert Thermocouple output voltage (in mV) to Temperature (in C)
Convert Thermocouples of types (B,E,J,K,N,R,S,T) output junction voltage (in mV) to temperature (in C) using NIST coefficients r...

5 years ago

Problem


Convert Thermocouple output voltage (in mV) to Temperature (in C)
Convert Thermocouples of types (B,E,J,K,N,R,S,T) output junction voltage (in mV) to temperature (in C) using NIST coefficients r...

5 years ago | 0 | 5 solvers

Solved


Compute a sum involving the totient over divisors of a number
Write a function to compute the following sum: where is the totient function. The sum is computed over the divisors of (inc...

5 years ago

Solved


The Piggy Bank Problem
Given a cylindrical piggy bank with radius g and height y, return the bank's volume. [ g is first input argument.] Bonus though...

5 years ago

Solved


Radioisotope Thermoelectric Generator (RTG)
Given an isotope's atomic mass (in amu), half-life (in years(a) or days(d)), and average kinetic energy absorbed (of emitted dec...

5 years ago

Problem


Radioisotope Thermoelectric Generator (RTG)
Given an isotope's atomic mass (in amu), half-life (in years(a) or days(d)), and average kinetic energy absorbed (of emitted dec...

5 years ago | 0 | 6 solvers

Load more