Respondida
How to use for loops to calculate the determinant of the first n powers of 2x2 matrix (A) without using the implicit Matlab command "det"
To calculate the determinant of a 2x2 matrix, see this link a little over halfway down the first page: http://mathworld.wolfr...

casi 11 años hace | 0

Respondida
Filling up a matrix
How about a simple loop: result = zeros(13,69); for k=1:69 n = numel(mycellarray{k}); result(1:n,k) = myce...

casi 11 años hace | 1

Respondida
How to test for integers and delete integers that do not perform to the test
Hint: Take a look at the result of rem(A,1)==0. What do you get if you sum this up?

casi 11 años hace | 1

Respondida
Can anyone help me to find the mistake in this code?
Why the switch from W to V? Seems to me you should be using W all the way through. E.g., W = W(I); Z1 = W1(I).*sqrt(-2....

casi 11 años hace | 0

| aceptada

Respondida
I have arrays and I want to put them in a table
Does this do what you want: mytable = table(Station_1,Station_2,Station_3,Station_4,Station_5,'RowNames',{'Pressure','Temp'...

casi 11 años hace | 0

Respondida
How to compare class type of 2 variables to find equality and use it within switch-case
What if you simply switched on the value of c? E.g., switch c Does this do what you want? Or is there something else y...

casi 11 años hace | 0

Respondida
Matrix dimensions don't agree
Try changing the division to element-wise: pred = (((K-b)*(age.^2))./((a^2)+(age.^2)))+b; % <-- Changed / to ./

casi 11 años hace | 0

| aceptada

Respondida
Is it possible to make alias for a variable?
The closest thing in MATLAB to this might be a classdef object derived from handle, where multiple variables actually "point" to...

casi 11 años hace | 0

Respondida
Wrapping a MEX function that has an "ans" output in some cases
I am not on a machine with MATLAB at the moment to verify this, but I think the syntax for passing variable number of arguments ...

casi 11 años hace | 2

| aceptada

Respondida
Finding rows with the closest values in two matrices matlab
E.g., not sure if this is what you want but to make B look like the order in A, keying off of the 2nd column and keeping the row...

casi 11 años hace | 0

Respondida
quat2angle function
If you run the code below, you can confirm the following with respect to the functions in the Aerospace Toolbox: The rotation...

casi 11 años hace | 0

Respondida
Relative motion between Quaternions
In general, for unit quaternions you would multiply the conjugate of one times the other, and then extract the angle and rotatio...

casi 11 años hace | 3

Respondida
Convert 8 Byte timestamp to a human readable time!
I haven't gone through your one-liner in any detail, but if you are starting with the 8 bytes shown above, then a simple typecas...

casi 11 años hace | 0

| aceptada

Respondida
Decoding DNA sequence into binary
One way: s = 'TGACTCAGTCGTTCAATCTATGCC'; % Input DNA string [~,x] = ismember(s,'ATGC'); % Convert the ATGC into indexe...

casi 11 años hace | 0

| aceptada

Respondida
How do i do a for loop within a for loop with a variable changing n=1:42.
Why can't you use simple if-tests on the value of n to set the value of I?

casi 11 años hace | 0

Respondida
How can you get totals from separate cell arrays?
Use cell2mat to convert them to doubles, then add them up.

casi 11 años hace | 0

| aceptada

Respondida
Help with Alogrithm????
You could save the x and y result from each iteration in a vector, but rather that do that you don't really need the for loop at...

casi 11 años hace | 0

| aceptada

Respondida
If I have a 4x4 cell array, 'm' where each element is a matrix expressed as '4x4 double', what would be the notation to access the values of a matrix within 'm'.
For a cell array m, m(i,j) is the i'th row, j'th column element of m. m(i,j) is a 1x1 cell array. m{i,j} is the ...

casi 11 años hace | 1

| aceptada

Respondida
how to save array values in .mat file in 1 column and multiple rows instead of multiple columns in 1 row.
Transpose j before saving it. E.g., j = j.'; % <-- transpose j save('j.mat', 'j');

casi 11 años hace | 0

| aceptada

Respondida
Adding the elements to next element
result = cumsum([initial_A A]);

casi 11 años hace | 0

| aceptada

Respondida
Why does char give me an empty output?
Characters for ASCII codes 1, 2, 3, 4, 5 are all unprintable characters, so nothing prints. The conversion *did* take place, but...

casi 11 años hace | 2

| aceptada

Respondida
Issue with random function
What is the class of the variable random? Is it a double at the command line but something else in your script?

casi 11 años hace | 0

Respondida
random number from a set of define numbers
Try this: HOT = [3,11,29,30,33,35]; OTHER = 1:37: OTHER(HOT) = []; x = randperm(6,3); y = randperm(31,3); pi...

casi 11 años hace | 0

| aceptada

Respondida
Why won't my code run? Matlab just says its busy when i run it?
The f(0) looks like a typo in this line: if sign(f(a)) * sign(f(0)) < 0 As for the rest of the code, nobody is going to ...

casi 11 años hace | 0

Respondida
While Loop is not ending, just keeps repeating from top
Some slight changes: colour = {'Red','Green','Blue'} x=colour{randi(numel(colour))}; % <-- Added semi-colon so you don't...

casi 11 años hace | 0

| aceptada

Respondida
How can I find the maximum deviation between two matrices?
Maybe this? max(abs(A(:)-B(:)))

casi 11 años hace | 0

Respondida
Choosing one answer from 3 in Solve
To get the real part of the 3rd element, e.g., >> x = [-1.35-4.59i , -0.136-4.59i , 1.18+9.18e-41i] x = -1.3500 - 4...

casi 11 años hace | 0

| aceptada

Respondida
counting number of inputs
Use a variable as a counter. E.g., suppose the variable name was guesses. Start with guesses=0 and then do guesses=guesses+1 fo...

casi 11 años hace | 0

Respondida
How to delete a submatrix from a matrix using the ZEROS command instead of [ ] square brackets?
Using explicit brackets [ ] on the right hand side of an equation combined with using indexing on the left hand side variable is...

casi 11 años hace | 0

Respondida
how to get the value a number at a specify decimal position ?
Use sprintf, find the decimal point, then get the desired digit after the decimal point. That being said, realize that for some...

casi 11 años hace | 0

| aceptada

Cargar más