Answered
why is this code not working?
Function works fine. f=@(x)x.^2.*sin(x)-x.*cos(x)+3;%sample function df=@(x)x.^2.*cos(x)+3*x.*sin(x)-cos(x); [root,iter,v]=ne...

3 years ago | 1

| accepted

Answered
How to create a polar plot?
load S x = real(S); y = imag(S); rho = sqrt(x.^2+y.^2); theta = atan2(y,x);%use atan2 (4 quadrant) polarscatter(theta, rho,...

3 years ago | 0

| accepted

Answered
custom distance with the kmeans
data=randi(100,10,2); centroid1=randi(100,1,2); centroid2=randi(100,1,2); m=sum(abs((data-centroid1)./std(data(:,1))),2); n=...

3 years ago | 0

Answered
How to keep false as false, and not as zero
If you are just using false as a flag, change false into some other number flag. You could use a particular number that will nev...

3 years ago | 1

| accepted

Solved


Cluster Partition
Given an array (row or column) of numbers, divide the array into consecutive positive/negative numbers. 0 is to be treated inde...

3 years ago

Solved


Find the dividend
Given a vector of pairwise coprime positive integers, p, and a vector of corresponding remainders, r, return a positive integer,...

3 years ago

Solved


Multiply each matrix element by its row index and add its column index.
Return a matrix the same size as the input, multiply each element by its row index and add its column index. Example: x = [ 1 ...

3 years ago

Answered
how to get the same result using rand
s=sum(rand(2,1e6)-.5); histogram(s,40)

3 years ago | 1

Answered
Grouping consectuve datapoints from a table into an array
Best to keep all the data together. Just reshape the array and index into it. pulse=reshape(yourTable.InstantPowerX,3,[])';%pul...

3 years ago | 0

Answered
Plotting a scaler and adding a legend to graph
Look at legend to add an appropriate legend. % in m/s v= 0:1:261; AirDen= 1.225; CdA=0.501; coefficient =0.006; g=9.81; m...

3 years ago | 0

Answered
How to dynamically name a large number of tall tables?
This should read all tables one at a time, combine the same categorical names, and store new tables as the categorical names. d...

3 years ago | 0

| accepted

Answered
Efficient way to reshape data
data = [ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ...

3 years ago | 0

| accepted

Solved


Easy Sequences 79: Trailing Zeros of Fibonorial Numbers at any Base
The fibonorial of an integer is defined as follows: where: is the -th Fibonacci number ( and for ). I...

3 years ago

Solved


Construct a "diagAdiag" matrix
Construct a matrix whose elements begin from 1 and end at n^2 with the order of arrangement as shown below: For: n = 4 ...

3 years ago

Solved


Cumulative minimum of an array
Find the cumulative minimum of an array without using the built-in function <http://www.mathworks.com/help/matlab/ref/cummin.htm...

3 years ago

Solved


Cumulative maximum of an array
Find the cumulative maximum of an array without using the built-in function cummax (and a few others). Your function should act ...

3 years ago

Solved


love is an n-letter word
Given a list of *N words*, return the *N-letter word* (choosing one letter from each word) with the property of having the least...

3 years ago

Solved


Create a recurrence matrix for a vector of data
In <https://en.wikipedia.org/wiki/Conversation_analysis conversation analysis>, it's often useful to track the contributions fro...

3 years ago

Answered
Angle between two 3D vectors
I don't see anything wrong. I assume you are using a loop. st_direction =[0.6320;0.7308;0.2579]; A =[-0.8903 -0.6071 -0.7...

3 years ago | 1

| accepted

Answered
How to solve a function with uknown parameter with bisection method
x=13.61015;y=13257; f=@(p)(x^3+p.^(2*x^2)-10)*sin(x)-y; p=fzero(f,1) P=1.01:.00001:1.03; plot(P,f(P))%plot shows zero crossi...

3 years ago | 0

Solved


Convolution Power
Create the convolution-power vector from initial vector _x_ and power _n_. In other words, similar to the scalar case, raising ...

3 years ago

Solved


does it touch ?
given a sentence, tell how much it touches. input : string output : how much it touches touching : a bilabial phoneme d...

3 years ago

Answered
Coding and ploting of a serie
t= 0:0.001:1; n=1:5; a=[0.05282 -0.00909 -0.02733 0.02509 -0.00268]; b=[-0.04866 -0.0104 0.002598 0.02111 -0.01372]; w=8.48...

3 years ago | 0

| accepted

Answered
How I Code the limit integration??
f=@(x).5*exp(-.2*x).*sin(10*pi*x); I=integral(f,0,1)

3 years ago | 0

Answered
sums with for loop
n=1:502; s=sum((-1).^(n+1)./(2*n-1))

3 years ago | 1

| accepted

Answered
Input or put a large array of numbers into a function
x='locate';prob=[.1 .18 .02 .4 .08 .22]; p=[];order=3; n=nchoosek(1:length(x),order); for k=1:size(n,1) p=[p;perms(n(k,:...

3 years ago | 0

| accepted

Solved


String Array Basics, Part 2: Convert String Array to Cell Array; No Missing Values
<http://www.mathworks.com/help/matlab/characters-and-strings.html String array> and cell array are two types of containers for s...

3 years ago

Solved


Find the outlier in a set of samples
Given an array x of numbers. Assumed that this array has one outlier. Find the position p and the value v of the outlier in this...

3 years ago

Answered
How to merge matrix in a loop?
A=randi(10,4,3) B=randi(10,5,3) C=randi(10,6,3) D=randi(10,7,3) N=2; newMatrix=generateMatrix(A,B,C,D,N) function ne...

3 years ago | 1

| accepted

Answered
for loop through matrix index
Your sizes can be different, store in cell array. for i = 1:length(lc) S{i} = new_ch(max([lc-pre_stim,1]):min([lc+(post_st...

3 years ago | 1

| accepted

Load more