Respondida
How do I get rid of a dimension of length 0 in a multi-dimensional array?
A variable that has a 0 dimension is an empty variable ... there is no data in it to reshape. You need to backtrack in your cod...

alrededor de 6 años hace | 0

| aceptada

Respondida
ode euler - explicit method
Add this after each figure statement hold on

alrededor de 6 años hace | 0

| aceptada

Respondida
Monte Carlo Simulation - pair of dice roll
You are supposed to count the number of rolls it takes to get boxcars, not the number of boxcars you get in N rolls. So for eac...

alrededor de 6 años hace | 0

| aceptada

Respondida
How to concatenate two time arrays with the same time step?
Ttotal = [t1,t1(end)+1+t2];

alrededor de 6 años hace | 1

| aceptada

Respondida
generate a vector y containing 2000 random numbers with a mean of 5 and standard deviation of 3
hist(y) or histogram(y)

alrededor de 6 años hace | 0

Respondida
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...

alrededor de 6 años hace | 0

| aceptada

Respondida
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 ...

alrededor de 6 años hace | 0

| aceptada

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

alrededor de 6 años hace | 0

Respondida
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 ...

alrededor de 6 años hace | 0

Pregunta


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...

alrededor de 6 años hace | 1 respuesta | 6

1

respuesta

Respondida
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...

alrededor de 6 años hace | 3

| aceptada

Respondida
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...

alrededor de 6 años hace | 0

| aceptada

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

alrededor de 6 años hace | 0

Respondida
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];

alrededor de 6 años hace | 1

| aceptada

Respondida
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...

alrededor de 6 años hace | 0

Respondida
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 ...

alrededor de 6 años hace | 2

Respondida
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...

alrededor de 6 años hace | 0

Respondida
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./(...

alrededor de 6 años hace | 0

Respondida
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...

alrededor de 6 años hace | 0

Respondida
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...

alrededor de 6 años hace | 1

Respondida
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...

alrededor de 6 años hace | 2

| aceptada

Respondida
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) -...

alrededor de 6 años hace | 0

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

alrededor de 6 años hace | 0

| aceptada

Respondida
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...

alrededor de 6 años hace | 0

Respondida
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...

alrededor de 6 años hace | 0

| aceptada

Respondida
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...

alrededor de 6 años hace | 4

Respondida
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...

alrededor de 6 años hace | 0

| aceptada

Respondida
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 ...

alrededor de 6 años hace | 1

| aceptada

Respondida
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:...

más de 6 años hace | 0

| aceptada

Respondida
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 ...

más de 6 años hace | 0

| aceptada

Cargar más