Beantwortet
How do I access a field from a function's input?
Assuming you are passing in a character string for freq, use this syntax: output = myStruct.(freq);

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
How can I obtain the T and Y for R Runge Kutta method?
The first version has an error. This line: k3=h*feval(f,T(j),Y(j)); should be this instead: k3=h*feval(f,T(j)+h/2,Y(j)+k2/2);...

fast 5 Jahre vor | 0

Beantwortet
How to solve array indices error?
x1 = 0*ft; : distance1=sqrt((x1-x2)^2+(y1-y2)^2+(z1-z2)^2); : sp = distance1(x1,y1,z1,dx,dyv(i),dz); % incident di...

fast 5 Jahre vor | 0

Beantwortet
Solving ODE using Euler Method and 4th Order Runge Kutta Method
You pretty much have the Euler scheme worked out, so I will help you with a vector formulation. Take this code: for i=1:n ...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
Problem finding sum of array using vectorization
The first element of x is 1, so that element produces 1/(1-1) = 1/0 = inf in the second line. You need to rewrite that second li...

fast 5 Jahre vor | 0

Beantwortet
Multiplication of large matrix with its transpose
The fastest way is to simply write it as A * A', because MATLAB will see that the operands are the same and call a special multi...

fast 5 Jahre vor | 0

Beantwortet
Solving ODE in MATLAB using Runge-Kutta method of order 4
Why aren't you using this to update z: z(i+1) = z(i) + (1/6)*(l1+(2*l2)+(2*l3)+l4);

fast 5 Jahre vor | 0

Beantwortet
Why is the string type not implemented as standard type?
All of the standard full numeric types as well as char and logical are implemented as simple rectangular data arrays. The string...

fast 5 Jahre vor | 1

Beantwortet
how to print randomly selected column?
Shouldn't that be size(data,2)? Also, generally you should be using string comparison functions for the tests, not the == opera...

fast 5 Jahre vor | 0

Beantwortet
NaN shows up in matrix when solving my ODEs, how can I fix this?
"All of my matrices I am solving for have NaN after the third time line. How do I solved this issue?" Set up a breakpoint somew...

fast 5 Jahre vor | 1

| akzeptiert

Beantwortet
Mean of multidimensional array
Doesn't mean(mdar,3) do what you want?

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
Function Error: Array indices must be positive integers or logical values.
When you have parentheses appear on the left hand side of an assignment like this: v(ro,ri) = (sqrt(m/(ri)))*((1/sqrt(R))-((sqr...

fast 5 Jahre vor | 1

| akzeptiert

Beantwortet
MXCREATEDOUBLEMATRIX memory overflow error
Rather later for an Answer, but here goes anyway: You should never use literal integers for API calls, because you can't be sur...

fast 5 Jahre vor | 0

Beantwortet
How can I solve x^4-1=0
doc roots

fast 5 Jahre vor | 0

Beantwortet
Convert unsigned integer to decimal
Not sure what the real question is here. Does one of these do what you want? int1 = uint32(hex2dec('9d900000')); int1 = uint32...

fast 5 Jahre vor | 0

Beantwortet
convert integer to bytes
Depending on what you are doing downstream with this, you can use the typecast( ) function. E.g., bytes = typecast(my_integer,'...

fast 5 Jahre vor | 1

| akzeptiert

Beantwortet
Selecting multiple different rows in a 3D matrix
You can use a vector for the indexing. E.g., x = matrix(:,:,[2:16,24:48]); Does that, or something like that, do what you wan...

fast 5 Jahre vor | 1

Beantwortet
Using a variable vector in a loop
Suppose you store the column vectors in a matrix called V. Then vk would simply be V(:,k). And if the uj are stored in a matrix...

fast 5 Jahre vor | 1

| akzeptiert

Beantwortet
Fortran code in Matlab
I'm trying to figure out the purpose of the backslash \. If this was the last character in the format statement then I would ass...

fast 5 Jahre vor | 0

Beantwortet
Assigning mxUint16 variable to plhs[0]
You cannot attach native C/C++ memory to an mxArray. The MATLAB API "mxSetEtc" functions check to see that the memory addresses ...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
How to separate a vector into two different vectors?
Others have already pointed out better ways of doing this. But to answer your question as to why your current code is not workin...

fast 5 Jahre vor | 1

Beantwortet
Nested "For Loop" Array Size
To keep the indexing the same, just use the top value from the loops. E.g., DataArray = nan(300,50,100,numel(inputValsY3)); No...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
convert value from radian form to degree form
If you have values, then just number_in_radians = number_in_degrees * (pi/180); If you are working with trig functions, note t...

fast 5 Jahre vor | 0

Beantwortet
Calculate taylor series using while loop
Looks like you are planning to use the identity ln(5) = ln((1/5)^-1) = -ln(1/5) and then use 1/5 as the x in the Taylor Series e...

fast 5 Jahre vor | 0

Beantwortet
How to multiply row of matrix A with column of matrix B?
Maybe this is what you want? C = sum(A .* B.',2)

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
Create variable with names of cell array
See this link: https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-ev...

fast 5 Jahre vor | 0

Beantwortet
just started matlab just wondering how to set up a 'for' loop
Here is an outline to get you started: x = _____; nmax = _____; result = 0; for n=1:nmax result = result + _____; end ...

fast 5 Jahre vor | 0

Beantwortet
How can ı solve this triangle problem at MATLAB?
If you can find cos(x), you might look at feeding that into the acos( ) function to recover x.

fast 5 Jahre vor | 1

| akzeptiert

Beantwortet
interpolation for 4cos(x) − ex = 0
Without seeing the text of your assignment, I would presume that this is the outline of what you are supposed to do: 1) Define ...

fast 5 Jahre vor | 1

| akzeptiert

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

Mehr laden