Respondida
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...

casi 11 años hace | 0

Respondida
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=...

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 0

| aceptada

Respondida
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...

casi 11 años hace | 0

| aceptada

Respondida
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 ...

casi 11 años hace | 0

| aceptada

Respondida
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...

casi 11 años hace | 0

| aceptada

Respondida
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...

casi 11 años hace | 0

| aceptada

Respondida
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...

casi 11 años hace | 0

Respondida
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 = ...

casi 11 años hace | 0

Respondida
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 ...

casi 11 años hace | 0

Respondida
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 ...

casi 11 años hace | 3

| aceptada

Respondida
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}); ...

casi 11 años hace | 0

| aceptada

Respondida
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...

casi 11 años hace | 0

Respondida
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 ...

casi 11 años hace | 1

Respondida
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...

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 2

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

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 0

Respondida
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 ...

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 1

| aceptada

Respondida
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.

casi 11 años hace | 0

Respondida
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 ...

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 0

| aceptada

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

casi 11 años hace | 0

| aceptada

Respondida
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.

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 0

Respondida
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 ...

casi 11 años hace | 0

Cargar más