Answered
plot graph using Tsiolkovsky’s rocket equations.
This Speed(1) = ... needs to be this Speed(i) = ... and this ... v_e*m(i)/m(i-1) ... should be this ... Time_step*v_e*dmd...

6 years ago | 0

| accepted

Answered
How to solve coupled differential equations with more than one dependent variable and only one independent variable?
This dy(3)= -3*y(1)*y(3)+2*y(2)^2+y(4); should be this dy(3)= -3*y(1)*y(3)+2*y(2)^2-y(4); % changed +y(4) to -y(4) Also, if ...

6 years ago | 0

| accepted

Answered
About mex function problem
This code is incorrect: int nVars,nSteps,lhs_dims[2]; : plhs[0] = mxCreateNumericArray(2,lhs_dims,mxDOUBLE_CLASS,...

6 years ago | 0

Answered
How to graph a complex system of ODEs?
You have three 1st order equations, so you need a 3-element state vector for this. To keep the same nomenclature as the MATLAB ...

6 years ago | 0

Question


Why is the new "half" data type an opaque class?
The good news: The new half precision data type was introduced in R2019b. Graphics cards have been using this for quite some t...

6 years ago | 1 answer | 6

1

answer

Answered
How to convert half-precision number into hexadecimal representation?
I don't have R2019b installed so I don't know how half precision numbers are stored, but can you use typecast: h = your half pr...

6 years ago | 3

| accepted

Answered
Issue with the cross product of my r and v vectors.
You need to make your r and v matrices of 3-element column vectors, not one long string of number all in a row. That means putt...

6 years ago | 0

| accepted

Answered
Deleting Row and Column
Q = P(1:end-2,1:end-2);

6 years ago | 0

Answered
Custom Euler's Method for Second Order ODE
Your derivative matrix is wrong. It should be this (the -5 and -1000 are switched): A = [0,1;-1000,-5];

6 years ago | 1

| accepted

Answered
I am 2nd year university student and unfortunalty due to corona virus im strugging with Matlab code. Can i email someone on here who has time to help me with a few questions on a car crash study.
This is essentially a pendulum problem with two forces acting on it instead of just one, gravity acting vertically down and cras...

6 years ago | 0

Answered
Override subsasgn of MATLABs double?
Overriding subasgn for a native class like double is a very bad idea, because it affects everything, not just the code that you ...

6 years ago | 2

Answered
Need help solivng euler method code
This n = numel(y0); needs to be this instead n = numel(x); % number of independent variable values Then you need to initiali...

6 years ago | 0

Answered
How to plot simple function
Error message says to check for mismatched delimiters. So this y=(1/(1+(25*x^2)); should be this with one fewer paren: y=1./(...

6 years ago | 0

Answered
A function calculating the value of expression (sin(x) - x)*x^(-3).
So, for small values of x your code looks correct to me (although the N=200 is WAY WAY OVERKILL ... you don't need nearly this m...

6 years ago | 0

Answered
Index in position 1 is invalid. Array indices must be positive integers or logical values.
What are the values in Fb and Tb? You can do this at the command line: dbstop if error Then run your code. When the error occ...

6 years ago | 1

Answered
Most Efficient Way to Construct the Matrices to Extract the Lower and Upper Triangle from a Vectorized Matrix
Here is a mex routine that generates the sparse double matrices mL and mU directly, so no wasted memory in creating them. Seems...

6 years ago | 2

| accepted

Answered
How do you substitute x(1),x(2),x(3) in place of kp,ki and l respectively?
To keep your equation the same, e.g., y1 = @(kp,ki,l) ((1/10^(l + 1)*ki*kp*l*sin((pi*l)/2))/(kp + (ki*kp*cos((pi*l)/2))/10^l) -...

6 years ago | 0

Answered
what is the number in a position in an array?
Indexing: m(2)

6 years ago | 0

| accepted

Answered
Dont why i keep getting reshape error anytime i run this.
This line reshape = reshape(encrypt,50,50); %50x50 shadows the MATLAB reshape( ) function with your own variable called reshap...

6 years ago | 0

Answered
When ever I use disp() Matlab prints out an extremely long fraction, that turns out to be correct
When you see those long fractions it means you have invoked the Symbolic Toolbox. To get that result back to normal doubles, ju...

6 years ago | 0

| accepted

Answered
mex error: cannot convert ‘int*’ to ‘const mwSize* {aka const long unsigned int*}’
I haven't looked at the code, but the error messages indicate you've got some definitions in your code like this: int dims[what...

6 years ago | 4

Answered
Help with my mex function output from cudamemcpy2D
Why is this created as a single class, and then a short pointer is used to access it? *A = mxCreateNumericArray(ndim2, dims_n4...

6 years ago | 0

| accepted

Answered
Meaning of "theSum = sum(theString - '0')"
This theString - '0' turns both arguments into doubles with the ASCII values and subtracts them. That is, the '0' value gets ...

6 years ago | 1

| accepted

Answered
Help with how to include a mean value calculator in a for-loop
Does this do what you want? arsol2015 = mean(reshape(sol2015,24,[])); Although not needed, your loop could be this for i = 1:...

6 years ago | 0

| accepted

Answered
Finding collumn with specific values within matrix
Is this what you are trying to do? indt = ind(1:5,:)'; [~,k] = ismember(sort(v1)',indt,'rows'); index1 = ind(6,k) The first ...

6 years ago | 0

| accepted

Answered
is matlab variable object?
All variables have a "class". But not all variables are objects from an OOP class defined with classdef. I think what you are ...

6 years ago | 0

| accepted

Answered
how to find the position of in the matrix without using the neither find nor built in functions.
Just add variables to keep track of the locations. E.g., if M(a,b) < min min = M(a,b); mi...

6 years ago | 0

| accepted

Answered
8 digit double array to 1 digit double array
For column vector H: H_conv = cell2mat(arrayfun(@(x)sprintf('%08d',x),H,'uni',false)) - '0'

6 years ago | 0

Answered
What does it mean when you put Loop = 1; in a program
This is a "forever" loop. It executes until a break statement is encountered. E.g., the general construct is while( 1 ) % ...

6 years ago | 0

Load more