Answered
why "symsum(sin(k*pi)*k,0,n)" not equal zero
I don't think Matlab recognizes that sin(pi)= 0, therefore it cant simplify further sin(pi*n)*(n/2 + 1/4). Just type sin(pi) and...

10 years ago | 0

Answered
Testing for statistical independence of two vectors
Correlation is one method to check dependence: x=1:100; y=1:100; correl = corr(x(:),y(:)) x=rand(1,100); y=...

11 years ago | 0

Answered
Interpolation and missing values
x_gap = x(2:end)-x(1:end-1); ind=find(x_gap>0.025); ind_int=[]; for j=1:numel(ind) ind_int = [ind_int,find((xi...

11 years ago | 0

| accepted

Answered
Putting figures within rectangles
x=1:10; y=1:10; figure; subplot(2,2,1) plot(x,y); t=title('a'); subplot(2,2,2) plot(x,y); t...

11 years ago | 0

| accepted

Answered
How can I refer to the diagonals of a matrix?
In case you want to use the diagonal values without saving the locations of the values, you can use diag. diag(A,0) is ...

11 years ago | 0

| accepted

Answered
Nested for loop still not working...
You should do for k = 1:length(InstNames) for i = 1:length(DataNames) So add the 1:. This: for k = length(Inst...

11 years ago | 0

| accepted

Answered
Fzero Issues with complex equation with complex roots
The value of the function at pi is 10, not 0. Do you mean you want the value where the imaginary part of the function is 0? Then...

11 years ago | 0

| accepted

Answered
Matrix Calculation in MATLAB
Define x as symbolic variable. Also (2-x * 3-x) should be ((2-x) * (3-x)) else you are calculating (2- (x * 3) -x). So: sy...

11 years ago | 0

Answered
Getting wrong results with fft
y = signal; %the signal you want to fft L = length(y); NFFT = 2^nextpow2(L); % Next power of 2 from length of y Y = ...

11 years ago | 0

Answered
Slope of a line
(max([50 50])-min([50 50])) returns 0, since the minimum and maximum of the vector [50 50] is 50. This means that X=0 and ...

11 years ago | 0

Answered
Frustrating for what should be simpleā€¦ What have I done wrong?
For strings you shouldn't use == to compare but strcmp for case sensitive comparison or strcmpi for not case sensitive. So this ...

11 years ago | 3

| accepted

Answered
Calculating mean for lines generated from Hough Transform
Maybe something like this is what you need: mean_vec=[]; for ii=1:length(Meanpix) x=cell2mat(Meanpix{ii}); ...

11 years ago | 0

| accepted

Answered
Logistic Population growth... w. linear regression and polyfit
I dont understand what you want to do with the fit but the numbers are correct: coeff=polyfit(t,n,1) n_fit = polyv...

11 years ago | 0

Answered
Eigenvalue decomposition of very large matrices
If you have a sparse matrix (lots of zeros), you should use eigs (determines the eigenvalues of a sparse matrix). First declare ...

11 years ago | 1

Answered
How can I add rabdom variables to an ode
rand gives a random value between 0 and 1. The arguments of rand are not the boundaries but the size (of the matrix) of the outp...

11 years ago | 0

Answered
Can two first order transfer functions be added together in matlab to make a second order transfer function
Yes, unlike Mischa said you do get a second order tf because g and g1 do *not* have a common denominator. The result is: g2...

11 years ago | 0

Answered
How to use fminunc providing gradient and hessian?
What Matt said and the way you want to calculate the gradient and hessian is not gonna work. since val is just a single value, t...

11 years ago | 0

Answered
How to solve algebric loop in a simulink model?
Put a delay or memory block in the signal of the variable which gives the algebraic loop. The problem is that you probably use...

11 years ago | 2

Answered
Replace zero in a matrix with value in previous row
idx=find(A==0) A(idx)=A(idx-1)

11 years ago | 0

Answered
can you help me to ploting the number of operations and time of execution
Do you mean something like this: n=10000; i=47; j=0; while mod(n, i)~=0; if(j==0) ti...

11 years ago | 0

Answered
Only check if statement once, or, disable code block after 1 check
Sounds like persistent variables may one of the solutions here. Persistent means that the variable will still remember its value...

11 years ago | 0

Answered
How to plot an equation with two independent and one dependent variable?
it plots only points in vertical line because when you plot k has only a single value, namely 100. Add k=1:100; before the plot ...

11 years ago | 0

Answered
is it possible to close popup using command!!
If you want to close it immediately after it stops flashing you can add close gcf after the end. Or add a pause before...

11 years ago | 1

| accepted

Answered
Why I can not do this surf?
Because Z should be a 144*144 matrix. 1 value for each pair of x and y values.

11 years ago | 0

Answered
Problem in exporting figure: Can anyone fix a bug in this code?
Try using <http://www.mathworks.com/matlabcentral/fileexchange/23629-exportfig export_fig> for saving to .eps or .pdf. It works ...

11 years ago | 0

Answered
How can I create a new matrix with x and y coordinates using a for loop?
[y,x]=find(A==1); num=length(x); B=[(1:num)',x,y]; If you want to sort the points the way you described do for exampl...

11 years ago | 0

| accepted

Answered
How can I built a new matrix in a new method?
ind = find(Assem{1}==0); Assem{1}(ind)=[]; C(ind)=[];

11 years ago | 0

| accepted

Answered
Hello I have problem to connect line from solar cell block to inverter. I can't connect that line
That's because you have two outputs to the same point. If you want to add them use an add block.

11 years ago | 0

Answered
How to download a particular function of MATLAB ?
Type ver in matlab, a list of the installed toolboxes should appear. Check if Computer Vision System toolbox is installed. It it...

11 years ago | 0

Answered
How can I use "impulseest" to recreate the results of the deprecated "impulse" function?
Well, there is impulseestOptions where you can define input offset. I don't know much about this problem so can't help you much ...

11 years ago | 0

Load more