Respondida
Find the rational number k for which the matrix A= [1 2 k;3 -1 1;5 3 -5] is singular (iff the determinant is 0).
Hint: The matrix A will be singular if the first row [1 2 k] is a linear combination of the other two rows [3 -1 1] and [5 3 -5]...

más de 8 años hace | 0

| aceptada

Respondida
modular operation in matlab?
Assuming you mean 2750 = mod(x,7829), there are infinitely many solutions: x = 2750 + n * 7829, for any integer n

más de 8 años hace | 0

| aceptada

Respondida
MATLAB error: Output argument "variable" (and maybe others) not assigned during call to "function".
It appears that the 5th output argument, dec, isn't always necessarily assigned by your function. It is only assigned if the co...

más de 8 años hace | 0

Respondida
Requires More Input Arguments
_"...Requires More Input Arguments..."_ usually means you didn't call the function with enough input arguments. E.g., you could ...

más de 8 años hace | 0

| aceptada

Respondida
How to use optimizer with ode45?
You would start by writing code to numerically integrate your DE using ode45. You have a simple 1st order ODE. There is an examp...

más de 8 años hace | 0

Respondida
How to find the descending index in each row of a matrix?
E.g., assuming there is always a decrease: [~,x] = max(diff(A,1,2)<0,[],2); result = x + 1; If there is not a decreas...

más de 8 años hace | 0

| aceptada

Respondida
Limiting Precision on MATLAB
With floating point calculations you often need to use tolerances, so this if( forceSum < 0 ) would be coded something l...

más de 8 años hace | 1

Respondida
How can I make a quadratic approximation given two points and incidence angle at the second point?
Maybe something like this is what you need? (assuming by "incidence angle" you mean slope) % Construct some sample data for...

más de 8 años hace | 0

Respondida
Editing elements of vector inside mex function slow
I can think of no reason why writing to memory from a mxArray (off of the heap) should take a significantly different amount of ...

más de 8 años hace | 1

| aceptada

Respondida
cross product of two points
You probably have inadvertently created a variable named "cross". Delete this variable that is shadowing the MATLAB function "cr...

más de 8 años hace | 0

Respondida
ode45 error "Undefined function or variable"
Here is your derivative function signature: function drdt = boost(m0,Cd,G,Me,Re,Area,tspan,Thrust) As you can see, there...

más de 8 años hace | 0

Respondida
Error in outputting a variable from function
Change your switch-case logic to if-then-else logic. E.g., switch h >= 0 && h <= 105 case h >= 0 && h < 11 ...

más de 8 años hace | 0

Respondida
How to fix this error
You need to save the output of fun into specific elements of T, P, and D. E.g., h=0:1:105; for k=1:numel(h) [T(k)...

más de 8 años hace | 0

| aceptada

Respondida
What is wrong with my bisection method code?
You don't show us how you are calling this function, so it is hard to advise you what to correct for that. For the code itsel...

más de 8 años hace | 3

| aceptada

Respondida
All possible combinations of 0's and 1's
One way: s = 2^sum(a); result = repmat(a,s,1); % or result = zeros(s,size(a,2)); result(:,logical(a)) = dec2bin(0:s-1...

más de 8 años hace | 2

Respondida
Why position does not have to be limited between +pi/2 and -pi/2
Can you use atan2 instead of atan?

más de 8 años hace | 0

Respondida
index exceeds matrix dimensions
Type the following at the command line: dbstop if error Then run your code. When the error occurs, the debugger will pau...

más de 8 años hace | 0

| aceptada

Respondida
How to perform vector Matrix Multiplication
First I would suggest you reorder your dimensions to put the 4x4 matrices first, so that P is 4x4xn and T is 4x4xn. That way al...

más de 8 años hace | 1

Respondida
x = j:i:k creates a regularly-spaced vector x using i as the increment between elements. What about x = j:i:k:m? or j:i:k:m:n?
This is simply left-to-right operator evaluation. j:i:k:m:n evaluates as (j:i:k):m:n And, as stated in the doc: ...

más de 8 años hace | 0

| aceptada

Respondida
Error: Conversion to double from function_handle is not possible. Error in homework4 (line 18) deltaf(k) = function_fd(f,2,h(k));
deltaf is a double vector, but function_fd returns a function handle. You can't convert a function handle to a double, hence the...

más de 8 años hace | 1

Respondida
I can't call this function from the command window. The function is meant to output values and plot graphs from a data file.
Don't put literal values in the output of a function definition line. Use a variable instead. E.g., function [C Gouws,19114...

más de 8 años hace | 0

Respondida
Double for loop in a random walk. How do I loop over all particles simultaneously instead of looping the amount of steps for each separate particle one at a time?
If you want to walk all of the particles simultaneously, then simply reverse the order of your for-loops: for n = 1:N % Loop...

más de 8 años hace | 0

Respondida
How to make a for loop that sums all the odd values in the array?
Initialize your summing variable prior to the loop: summedValue = 0; Then inside the loop, add to it: for i = 1:...

más de 8 años hace | 1

Respondida
Can anyone help me solve this Matlab (while loop) series summation problem?
To make things easier on yourself, why not use the exact same variable names as the question? E.g., use k as the indexing variab...

más de 8 años hace | 2

Respondida
Binary to floating point representation using IEEE-754
Any method you choose is going to have to make assumptions about bit/byte ordering and the handling of the special inf, nan, and...

más de 8 años hace | 4

Respondida
Averaging rows with rows previous
Assuming the average includes the row in question: x = your matrix result = cumsum(x)./(1:size(x,1))'; Or for earlier...

más de 8 años hace | 0

| aceptada

Respondida
Replace zeros with text
_"... I'm trying to make a column n rows long that says the word 'hello' ..."_ a = ('hello')'; The above results in a c...

más de 8 años hace | 0

Respondida
Would you redefine the value of your loop index variable within the for loop?
Only if you want obfuscated code that is hard to understand and debug. In other words, no. Don't do this. If you need to redefin...

más de 8 años hace | 0

Respondida
Conditional entry-wise matrix operation
Hints: What does the expression -abs(X) do in relation to your condition of X_ij > 0? Could you use this in your formula fo...

más de 8 años hace | 0

| aceptada

Respondida
what is the difference between = and ==?
= is used for an assignment == is the element-wise equality comparison operator <https://www.mathworks.com/help/matlab/mat...

más de 8 años hace | 5

Cargar más