Respondida
I'm trying to plot the golden ratio to show that it converges
Just add a line to calculate the ratio at each step. E.g., Initialize prior to the loop: f_ratio = [1 1]; Then add in...

más de 11 años hace | 2

| aceptada

Respondida
hi. i got a problem to convert this equation into Matlab code perhaps can help me. it is about summation. thanks
Assuming the variables are each vectors of size N: sum((theta_bo - theta_mbo).^2) + sum((theta_to - theta_mto).^2)

más de 11 años hace | 0

Respondida
How to normalize values in a matrix to be between 0 and 1?
NormRows = sqrt(sum(Ypred.*Ypred,2)); Ynorm = bsxfun(@rdivide,abs(Ypred),NormRows);

más de 11 años hace | 0

Respondida
Write a MATLAB program that determines cos (x) using the Taylor series expansion.
Sn-1 is not meant to be typed in literally as you have done. It is meant to be the previous value of Sn. Also, x is required to ...

más de 11 años hace | 2

| aceptada

Respondida
How to find the number of times an elements occurs in an array and copy to another array with same index
If you have a later version of MATLAB: >> A = [1 4 6 1 5] A = 1 4 6 1 5 >> B = histcounts(A,m...

más de 11 años hace | 1

| aceptada

Respondida
Error operands of = have illegal types `pointer to double' and `double' in mex
You have created plhs[0] and plhs[1] as cell arrays, meaning that their data areas contain (mxArray *) types, not (double) types...

más de 11 años hace | 0

Respondida
How can I create a matrix of alternating 1s and 0s for any size matrix?
1 - mod(bsxfun(@plus,(1:n)',1:n),2)

más de 11 años hace | 1

Respondida
Running average from vector of data
x = 1:numel(AA); B = cumsum(AA)./x; plot(x,B);

más de 11 años hace | 1

| aceptada

Respondida
how to solve the error
This line defined Icrop as a double: Icrop=zeros(1,1000000) And the curly braces { } in this line use lcrop as a cell ar...

más de 11 años hace | 1

| aceptada

Respondida
matrix operation by element of other matrix
for i = 1:nmc a_trial = a + da(i); x = abs(a_trial) < abs(a); % Find all indexes where a_trial is closer t...

más de 11 años hace | 0

Respondida
Clearing variables in function workspace effect on memory
Once a function returns, all "local" variables to that function are automatically cleared. You don't need to manually do it. See...

más de 11 años hace | 2

| aceptada

Respondida
How to extract length along an angle that intercepts an ellipse.
To get started, e.g., >> % Original data >> E = [1 0; 0 0.5] E = 1.0000 0 0 0.5000 >...

más de 11 años hace | 0

Respondida
What is the difference in these errors?
E.g., one way to get these errors: >> A = rand(3) A = 0.9649 0.9572 0.1419 0.1576 0.4854 0.421...

más de 11 años hace | 1

| aceptada

Respondida
(AB)^T = (B^T*A^T) proof help
Transposing in MATLAB is accomplished with the ' and .' operators. The ' operator is actually conjugate transpose and the .' is ...

más de 11 años hace | 0

| aceptada

Respondida
assigning array to another
Is this what you want? B = zeros(10,30); % initialize Matrix B as 10 X 30, first as zeros B(1:9,:) = A(1:9,:); % B take...

más de 11 años hace | 1

| aceptada

Respondida
for loop output into matrix for pairwise comparisons
As you are starting to see, having variables with "dynamic" names ending in 1, 2, 3, etc. can quickly cause programming headache...

más de 11 años hace | 2

Respondida
Need help creating an array
And another way: A = full(spdiags(repmat([2 -4 2],n,1),[-1 0 1],n,n)); And yet another way: A = -4*eye(n); A(2:n...

más de 11 años hace | 0

Respondida
run C++ program in using MATLAB
Look at system and bang. E.g., http://www.mathworks.com/help/matlab/ref/system.html?searchHighlight=system http://www.math...

más de 11 años hace | 1

Respondida
dlmwrite function Could not open file
result.txt will go into your current directory. I.e., it will go into what this command shows: cd Do you have write perm...

más de 11 años hace | 1

Respondida
I'm not sure how to start out this program.
Read the doc for xlswrite here: http://www.mathworks.com/help/matlab/ref/xlswrite.html?searchHighlight=xlswrite Then look ...

más de 11 años hace | 1

Respondida
one thing i need to know
R = M' Or if you want to strictly transpose for complex arguments as well, R = M.'

más de 11 años hace | 2

Respondida
I am trying to create two vectors out of one,x, where one will contain all the positive elements and the other all the negative elements.
You are using k as a loop variable but only doing one iteration, k = 12. Maybe you want this result: P = x(x>0); N = x(x...

más de 11 años hace | 0

Respondida
Referring to variables with concatenated strings
Yes it is possible to do this using eval, but please do not do this! There are much better ways to organize your data using cell...

más de 11 años hace | 1

| aceptada

Respondida
Making IF conditional sentance.
f is a vector, so the expression f<f1 is also a vector. And when you try to use this vector with the && operator you get the err...

más de 11 años hace | 0

Respondida
Undefined function 'm' for input arguments of type 'double
Error seems straight forward to me ... once you reach that line m is not defined, hence the error. Is m supposed to be a vector ...

más de 11 años hace | 1

Respondida
Why do I get: "Error using vertcat Dimensions of matrices being concatenated are not consistent."
Entire has e columns single has 1 column So unless e == 1, they won't match and hence the error. That being said, it looks...

más de 11 años hace | 1

Respondida
Approximating Euler's number using randomly generated integers
Consider this: Since you have K numbers from 1 to K, for every duplicate number that means another number in the sequence was no...

más de 11 años hace | 1

| aceptada

Respondida
how to read data from a .mat file
Use the load function to read .mat files. E.g., load Ey1a.mat

más de 11 años hace | 1

Respondida
possible Bug? or checking if OverFlow happened?
How large is the average value? Is 100 close to eps of this average value? E.g., is the average value near 1e17? If so, this cou...

más de 11 años hace | 0

Respondida
Is it possible to add/combine matrices without increasing memory usage?
MATLAB can sometimes be coaxed into performing operations in place, but there are rules you must follow. Generally, you must be ...

más de 11 años hace | 0

| aceptada

Cargar más