Answered
How do I create a stacked plot like attached figure using subplot command ?
Try help stackedplot

6 months ago | 0

| accepted

Answered
Second order equations. Cauchy task
More like this: % Write equations as follows: % dudx = v u(0)=-1 % dvdx = -v/4-6u v(0)=0 % % Then you hav...

6 months ago | 1

| accepted

Answered
Runge Kutta 3 ODE
You can't have t(i)=t(0)+i*h; indices must be a positive integer - you have t(0), Matlab doesn't like this!

6 months ago | 0

| accepted

Answered
Why it is saying this? Index in position 2 is invalid. Array indices must be positive integers or logical values. Error in Homework (line 21) surf(x,y,F(i,j))
Like this x=[-5:5]; y=[-5:5]; for i=1:numel(x) for j=1:numel(y) if (x(i)>=0)&&(y(j)>=0) F(i,j)=2.*x(i)+y(j)^2; en...

6 months ago | 0

| accepted

Answered
Definite integral with parameter
You could try something like this: a = 0.043478; q = 100; % Ha W = 40; t = 4; c = @(x,Fa )(5.*x.^2-Fa.*x)./(((a.*x+q).*W-((...

6 months ago | 0

| accepted

Answered
Integration of a joint pdf with for loop?
When k = 1and i = 1 then k-i = 0, therefore the second index in fun(i,k-i) is 0, but indices must be positive integers in Matlab...

6 months ago | 0

Answered
How would you I write a matlab function for theta that represents the 2nd order differential of the torque equation?
Does this help? % Theta seems to have two components, so: D(theta) = [p1+p2+2*p3*cos(theta(2)) p2+p3*cos(theta(2)); ...

6 months ago | 1

| accepted

Answered
Error message with arrays
You only need h = [2:20:220]; t_a = 293; q_flux = 800; n = length(h); y = q_flux./h+t_a; i = i+1; plot(h,y)...

6 months ago | 0

Answered
How to solve two coupled differential equations using ode45.
"Why is my previous code is not working properly by treating the problem to be a DAE." I don't know! "Also I noticed you wrote...

7 months ago | 1

Answered
Multiple Anonym Function return wrong values
Here's one solution: C = [4622 5480 18923]*1e-12; U = [454e3 454e3-20e3 20e3].*sqrt(2); W = Energy(C,U); disp(W) function W...

7 months ago | 0

| accepted

Answered
Hi, is it possible to have variables in an ode45 that varies according to another function?
Put something like [T, p, rho, speedsound] = atmos(height); immediately after height = x(1); in function dynameqn. Not sur...

7 months ago | 0

Answered
root finding and plot of graph
Are you looking for something like this? hi = 1e-6; lo = 1e-9; n = 500; dt = (hi-lo)/n; t3 = lo:dt:hi; y = f(t3); subplo...

7 months ago | 0

Answered
Calculator result and MATLAB result are different
Have you checked that both are using degrees, or both radians? The Matlab as you've written it is using radians (use sind(24) a...

7 months ago | 1

Answered
How can I rotate a set of points by an angle around its origin?
Do you mean like this? ITM = [461400.0758 617474.3059 461400.8069 617475.4609 461400.8069 617475.4609 461402.3069 617477.633...

7 months ago | 1

| accepted

Answered
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
Try replacing x(4) = Velocities(3608.9,5249.3); by x(4,:) = Velocities(3608.9,5249.3); Same for x(5).

7 months ago | 0

Answered
Removing zeros from matrix
Like this? A = [1 2 3 4 5 6; 1 2 3 4 5 6; 1 2 3 4 5 0; 1 2 3 4 0 0; 1 2 3 0 0 0]; B = A'; B=B(:); B(B==0)=[]

8 months ago | 0

Answered
Error in ODE arguments
I suspect you mean like this (notice the way M divides, using the back-slash): % Numerical solution of IVP % M*xddot + C*x...

8 months ago | 2

| accepted

Answered
How to Approximate The Solution for an Initial Value Problem?
Try f = @(t,x) [x(2); sin(1.9*t)-4*x(1)]; [t,x] = ode45(f,[0,150],[1,0]); plot(t,x)

8 months ago | 1

| accepted

Answered
Creating a set range for a function
(x < 3) && (x > 25) An individual element of x can't be both less than 3 and greater than 25 at the same time. If here are ma...

8 months ago | 0

| accepted

Answered
Plotting the tangent line for newton raphson method
Like this? fx = @(x) x.^2 -2; dfdx = @(x) 2*x; n_step = 7 ; % Anzahl der durchzuführenden Schritte für Newtonverfahren...

8 months ago | 0

| accepted

Answered
Fit scatter plot with a curve
More like ths? x = [0.2337;0.296;0.3071;0.4208;0.2055;0.9597;0.8683;0.243;0.3363;0.2793;0.5292;0.2471;0.2282;0.4774;1.0392;0.43...

8 months ago | 1

| accepted

Answered
Generating random numbers with a different probabilities
Assuming there are just two levels of probability, and that the numbers are real, not just integers, you could try: p50 = 0.75;...

8 months ago | 1

Answered
Hi, what does ; exactly mean?
It means start a new row, e.g. x = [1 2; 3 4]; disp(x)

8 months ago | 0

Answered
Solve the IVP y′′′=sin(y2)+y′+cos(t), provided with an appropriate set of initial conditions of your choice, and using Matlab's ODE45 function.
Like this? (Note the IC for d^2y/dt^2 must be consistent with the values chosen for y(0) and dy(0)/dt). Change the IC's and tim...

9 months ago | 0

Answered
Need Help Solving System of ODEs
You haven't included the first term on the right-hand side of your equation for dV/dt, nor for dgamma/dt.

9 months ago | 1

Answered
spring mass using ode45
Like this x0 = [0; 0]; tspan = [0, 10]; [t, x] = ode45(@func, tspan, x0); subplot(2,1,1) plot(t, x(:, 1)); grid('on...

9 months ago | 0

Answered
I am getting error in this program. Please suggest the corrections.
Change c = [1 2 2 3 4 5 6 7]; to c = [1 2 3 4 5 6 7];

9 months ago | 1

Answered
Hello, I'm trying to plot one non-piecewise function and two piecewise functions in one graph but I keep getting an error. I don't understand the two error messages below.
You need to put the non-local functions at the end, as in the following. There were several other errors. I don't know if my co...

9 months ago | 0

Answered
How to Solve equation using Eulers method in Matlab?
Here's part (a) for you - definitely not a straight line!

9 months ago | 0

| accepted

Load more