Réponse apportée
How to solve three complex equations
Easy using matrix notation: A = [1.46j,0.9j,-0.36j;0.36,-0.42,-1.345;0.9j,1.65j,0.42]; b = [1;0;1]; I = A\b I = -0.00...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
If conditions for matrices with different length
I think you mean this (Note that the second element of T2 doesn't meet your conditions! as you posted as the expected output): ...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Printing Results out of a for Loop
You can also implement the function in a simpler and efficient way: function [rows_diff, tot_diff] = minimax(M) rows_diff ...

plus de 6 ans il y a | 0

Réponse apportée
Loading the excel file(cell array contains elements of different dimension) in MATLAB
Try this: [num,~,A] = xlsread('Area_Matrix.xlsx'); A(isnan(num)) = cellfun(@str2num,A(isnan(num)),'uni',0); %A is the cell arr...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
How to turn 64x1 matrix into an 8x8 matrix?
y = reshape(X,8,8)

plus de 6 ans il y a | 1

| A accepté

Réponse apportée
"Argument to dynamic structure reference must evaluate to a valid field name" error please code also been attached????? and also i cannot execute it.
You need to change those lines Vx = K.(sin(thetaInDegrees1)-sin(thetaInDegrees2)*cos(thetaInDegrees3)); Vy = K.(-sin(thetaInDe...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Increment Nonce by any fixed value in loop
Using a loop: nonce = {'00' '11' '22' '33' '44' '55'}; x = '01'; for i = 1:numel(nonce) nonce{i} = dec2hex(hex2dec(nonce...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Solve for array of values for cos and sin functions returning [0x1 sym]
One way: syms x y c a = x^2 + c - y == 3; % function a is overwritten in the next line! a = x^2 + sin(c*pi/180) - y == 3; %c ...

plus de 6 ans il y a | 1

| A accepté

Réponse apportée
How to randomly and uniquely select 2000 samples from an array with 1x460800.
Being A your array and N the number of random samples you want: B = A(randperm(numel(A),N));

plus de 6 ans il y a | 1

Réponse apportée
How to convert a one column vector to a matrix with N number of rows and M number of colunms
Let A your row vector, then: res = reshape(A,[],168)';

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Combinations of different rows of a matrix
A = rand(90,2); %Example b = nchoosek(1:size(A,1),2); res = reshape(cell2mat(arrayfun(@(i) A(b(i,:),:),1:size(b,1),'uni',0))...

plus de 6 ans il y a | 0

Réponse apportée
index out of bounds because numel(dt)=2016
In this loop: for I=1:N if dt((2*I-1)/2*Num_Unit)<0.25 c(I)=1; else c(I)=0; end end %where ...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Use isnan with input excel data containing a combination of strings and empty cells in a row
If you just want the text: [num, str, raw] = xlsread(INFILE) samplerow = str(1,:); samplerow(cellfun(@isempty,samplerow)) = [...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Changing two variables in a for loop
Try this: B = zeros(size(A,1),4*size(A,2)); B(:,1:4:end) = A;

plus de 6 ans il y a | 0

Réponse apportée
Replication factors must be a row vector of integers or integer scalars.
c must be an integer. Then, a solution: depth = [0.01 1.5:1.5:30]'; w = 10 - 0.5 .* depth; w(w<0) = 0; a=829862; b=21 c=ro...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
second largest peak value
To obtain the coordinates of the second peak you just need: [PkAmp, PkTime] = findpeaks(abs(hilbert(signal(1,:))),t); [~,idx]...

plus de 6 ans il y a | 1

| A accepté

Réponse apportée
Deleting every row with a zero in the first column, except the first row
Try this: A([false;~A(2:end,1)],:) = []

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
How to make matlab count
A =[1 2 3 4 5 1 2 3 5 6 7 2 4 3 5]; x=input('Number') sum(A(:) == x)

plus de 6 ans il y a | 1

Réponse apportée
how can we perform 6x6 matrix without values to find the inverse and determination
If you have the symbolic toolbox, you can do something like this: syms a11 a12 a21 a22 x = [a11,a12;a21,a22]; det(x) a...

plus de 6 ans il y a | 0

Réponse apportée
Different matrix multiplication results from the sparse and full version of the same matrix
That is the floating point error (it is not related with sparse or full matrix). See this: clearvars v1 = [0 0 1 0 1 3;0 0 0 0...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Is var command works also for complex numbers?
If you take a look at the var documentation https://es.mathworks.com/help/matlab/ref/var.html you can see that the definition is...

plus de 6 ans il y a | 1

| A accepté

Réponse apportée
Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in pid_optimized1 (line 17) solution(K,:) = [K a m ts];
You are using K as a logical indexer, but K take non positive integers values, throwing, then, an error. I gues that the solutio...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
How to find the complex root for this equations
First, one important suggestion: Don't call your function as one Matlab function (roots, in fact is the one that you need to cal...

plus de 6 ans il y a | 2

| A accepté

Réponse apportée
Function to find max value from function cell array
I see to possible answers depending on what you want: If you want to obtain the maximum value (for the three functions) for eac...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
How to calculate total distance traveled from position vs time experimental data
Following your image, you have a position array like: position = [10,10,0,0,-16,-16,0,14]; Then to calculate the total distanc...

plus de 6 ans il y a | 1

| A accepté

Réponse apportée
Conditional statement in a for/if loop
Try this: res = RDSM; res(LBOS > RBOS) = LDSM(LBOS > RBOS); T2 = table(frame,res);

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Cell array for legend in a plot loop
Putting the legend call out of the loop: % Get field names as a cell array names = fieldnames(Struct); % Declare the cell ar...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
How do I add a column to a cell array based on existing values in another column?
One option is: x(:,3) = deal({0}); x(ismember(x(:,2),'A'),3) = deal({1});

plus de 6 ans il y a | 1

| A accepté

Réponse apportée
could anyone help me how to randomly select the values.
Try this: res = b(randi(numel(b),1,5))';

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
Simple if statement always gives 0
You need to put && between two comparisons as: function f = W(t) if 0 <= t && t < (3/12) f = 0; end if ...

plus de 6 ans il y a | 0

| A accepté

Charger plus