Beantwortet
Solving a large number (thousands) of different "Ax=b" equations when the matrices A are all the same small size (3x3 to 6x6), but different numbers.
See this FEX submission by Bruno Luong: https://www.mathworks.com/matlabcentral/fileexchange/24260-multiple-same-size-linear-so...

fast 5 Jahre vor | 0

Beantwortet
euler's method
Your code does not have enough states. You have a 2nd order ODE (the highest derivative present is 2), so the state vector need...

fast 5 Jahre vor | 1

Beantwortet
Sum of series in matlab
You could use a simple matrix multiply for this (it looks like the x is the first row and the y is the second row): A = R(1,1:2...

fast 5 Jahre vor | 0

Beantwortet
How does vrrotvec calculate rotation?
It is a simple algorithm that uses the cross product for the axis (normalized), and the dot product is used to calculate the ang...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
How do I make a condition statement for an element that presents in two different arrays but is at the wrong position? This also applies to more than one elements
Assuming you have already made the check for the correct number in the correct spot, you can use this ismember(final_code_guess...

fast 5 Jahre vor | 0

Beantwortet
MATLAB determine if matrices are invertible or not
You can use rank( ) for this: https://www.mathworks.com/help/matlab/ref/rank.html?searchHighlight=rank&s_tid=srchtitle_rank_1 ...

fast 5 Jahre vor | 1

Beantwortet
Using Trapezodial rule Matlab
The trapezoid rule is for situations where you know the function values in advance, but you don't have this situation. I.e., if ...

fast 5 Jahre vor | 0

Beantwortet
fortran subroutine includes several other subroutines
Note that the timestwo.F example that comes with MATLAB is a bad example of Fortran code. It has several bugs in it that could l...

fast 5 Jahre vor | 3

Beantwortet
Call C/C++ Code from MATLAB Code
If your code includes a file called MyStruct.h, then yes you should have such a file. I would expect it to be something like th...

fast 5 Jahre vor | 0

Beantwortet
Matlab tries to use mex files not on search path
You should use debugging to find out why this is happening. Type the following at the command line: dbstop if error then run y...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
MATLAB: failed creating a diagonal matrix
You probably have inadvertently created a variable named 'diag' in your workspace, and hence diag(x) is simply indexing into thi...

fast 5 Jahre vor | 0

Beantwortet
For-loops are now faster than some of the simplest vectorized statements. Why do we still need so much deep copying?
I have read rumors in the past that TMW was tinkering with the idea of sub-array references, or some type of limited pointer cap...

fast 5 Jahre vor | 1

| akzeptiert

Beantwortet
what correction is required in the code?
If the homework assignment specifies you must use a loop, then I don't think the intent was for you to wrap a simple i=1 range a...

fast 5 Jahre vor | 0

Beantwortet
I am trying to solve 3rd order ode by RK45, but I did not get solution and plot, kindly fix my issues
The image appears to show seven equations (H1', H2', ..., H7') with boundary conditions at 0 and infinity. The RK45 scheme you ...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
If statement in loop with AND OR operands
The problem is that the comparison Outcome{j} == '11_right' is an array comparison, not a scalar comparison. I.e., the string i...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
How to create a equally distributed batting order for little league baseball team
Start with a simple pattern that works, and then randperm both the rows and columns. E.g., B = zeros(10); for k=1:10 % start w...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
Unable to perform assignment because the size of the left side is 1-by-1 and the size of the right side is 1-by-2
Does this do what you want: Xindex(r, :) = [index rowidx]; You can get rid of c altogether since it isn't needed. And you nee...

fast 5 Jahre vor | 1

| akzeptiert

Beantwortet
How do I store a string from a MATLAB structure into a C structure in a MEX file?
Please show us the definitions of the variables involved. How large is cstructu->Field1, cstructu->Field2, and cstructu->Field3?...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
How to calculate sum(A .* (B * C), 'all') [Ed. actually sum(A .* log(B * C), 'all')] efficiently when A is sparse and B*C is full and large?
Here is the straightforward mex code (i.e., no parallel sections) if you want to try it out. It computes the result directly in...

fast 5 Jahre vor | 3

| akzeptiert

Beantwortet
what does the expression " if ( ) && ( ) " do
&& is the "logical and" operator. You can read about it here: https://www.mathworks.com/help/matlab/ref/logicaloperatorsshortc...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
How to calculate sum(A .* (B * C), 'all') [Ed. actually sum(A .* log(B * C), 'all')] efficiently when A is sparse and B*C is full and large?
You could use this loop to avoid the memory usage, but it will run slowly because of the data copying going on in the background...

fast 5 Jahre vor | 0

Beantwortet
ODE system with 2 degrees of freedom
I only see two variables, 1 and 2, and each is part of a 2nd order equation. So that would mean a 2 x 2 = 4 element state vecto...

etwa 5 Jahre vor | 0

| akzeptiert

Beantwortet
Extracting the sub-matrix
You might benefit from going through the onramp tutorials found here: https://matlabacademy.mathworks.com/details/matlab-onramp...

etwa 5 Jahre vor | 1

Beantwortet
How can I solve these differential equations?
A general outline would be to create your derivative function as follows: function dy = myderivative(t,y,T,E) Fa = y(1); Fb =...

etwa 5 Jahre vor | 0

Beantwortet
Exponent mantissa form of real numbers
Without seeing the actual wording of the assignment, I would assume this simply means "floating point notation". E.g., 123.456...

etwa 5 Jahre vor | 1

Beantwortet
Matrix product using for/while loop
The inner most loop needs to iterate over the 2nd index of M1, not the first index. E.g., while (k<=size(M1,2)) %<-- 2nd inde...

etwa 5 Jahre vor | 0

| akzeptiert

Beantwortet
What does 'li' mean?
1i is used to ensure it isn't confused with a variable named i that you might have in the workspace. I.e., 1i is always sqrt(-1...

etwa 5 Jahre vor | 0

Beantwortet
I have matrix A and I need to find (e^(At)) where t is the sampling time. How to find that? Also what is the difference between exp(A) and expm(A)?
exp(A) just takes the exp( ) of the scalar elements individually. I.e., exp(A(1,1)), exp(A(1,2)), etc. expm(A) takes the matri...

etwa 5 Jahre vor | 1

| akzeptiert

Beantwortet
help with my 4th order runge kutta code
My guess without seeing the rest of your code is that phi is a column vector, so when you add phi*h to the row vector Y(i,:) it ...

etwa 5 Jahre vor | 0

| akzeptiert

Beantwortet
how to change from for loop to while loop
You never change i or Errors within the while loop, so how is the loop ever supposed to exit? Maybe you want to add this line: ...

etwa 5 Jahre vor | 0

Mehr laden