Answered
Why does integration of an exponential function generate noisy results as opposed to its analytical solution?
You have a singularity when t = x(ii). Here's a rough and ready way to do the numerical integral (hmm! not sure the result is c...

1 year ago | 0

| accepted

Answered
Index exceeds the number of array elements. Index must not exceed 1
What are yoy trying to do with x_iEm(i) - h*x_iEm(i) == x_past + h*2*y; when i = 2, there is, as yet, no value assigned to x_...

1 year ago | 1

| accepted

Answered
Inconsistent results from "int" function
You can express '(y*(2*x + y)^2)/192 as (x*y*(x + y))/48+y^3/198 As far as the integral is concerned y is a constant, so the t...

1 year ago | 2

| accepted

Answered
Boole's Approximation
You are using Boole from -1 to 1, but the "exact" from 0 to pi. (You should plot G against x to see why your "exact" integral w...

1 year ago | 1

Answered
I'm trying to solve a system of differential equations using Euler's method, but I don't know what the problem is with my code. If you can correct me the problem
Don't confuse the number 1 with lower case l a= 0; b= 2; delta_x =0.5; y1(1) = 4; y2(1) = 6; n= (b-a)/delta_x + 1 ; x(1)...

1 year ago | 0

| accepted

Answered
How to add one sgtitle per row of suplots
Try subplot(2,3,1) scatter(62,VWE3a_diff,50,'MarkerEdgeColor','[0 0 0]','MarkerFaceColor','[0 0.5 1]','Marker','o') title('DM...

1 year ago | 0

Answered
How to add one sgtitle per row of suplots
Here's a quick and dirty way: x = 0:0.01:2*pi; for i=1:6 y = sin(x+i*pi/4); subplot(2,3,i) plot(x,y) ...

1 year ago | 1

Answered
How do you solve a System of 11 Non-Linear Equations Inter-linked to one another?
Here's a possible logic (though I seem to find negative values for U): U1 = 500; U2 = 500; % Initial guesses U0 = [U1 U2]; ...

1 year ago | 0

| accepted

Answered
Title in maths symbol and title as legend on each plot on different locations.
More like this? %% Set up the data (just enough to need a large legend and to show variety) t = linspace(0, 1, 11); x = linsp...

1 year ago | 0

| accepted

Answered
How to show Kinetic energy,potential energy at given ditance
Do you mean something like this: Tf=20; theta=60; height=5000; angle = 45; g=9.81; velocity=(g*Tf)/(2*sind(theta)); figur...

1 year ago | 0

Answered
Summation for every value of "n" (or summation with looping)
Like so: B=7.5; % angle value fn = @(n) (1+2*cos(n*B)).^5/2; n=1:50; Qn = fn(n); Q = sum(Qn); Pr= 395; P1= Pr/Q; disp(P1...

1 year ago | 1

Answered
Implementing while loop in Heun's Method
Here's a rough and ready way (I'll leave you to implement Heun's method): f = @(H) -0.06*sqrt(H); H = 4; t = 0; dt = 0.1; %...

1 year ago | 2

Answered
How to explain a difference in solutions of integrals between MATLAB and MAPLE?
This is what I get in Maple:

1 year ago | 0

Answered
I want to put arrows on each of the lines parallel to x-axis using LOOP
Like this? p = 0.02:.07:1; plot([0; 1],[p; p], 'color','b'); hold on %q = 0.2:.2:1; xx = [0.5 0.57]; ...

1 year ago | 0

| accepted

Answered
How can I plot this signal?
Like this? gm = 0.04; RL = 10000; CL = 10^(-9); f = logspace(-1,2); Av = (-gm*RL)./(1 + RL*CL*f*1i); %magnitude subplot...

1 year ago | 0

| accepted

Answered
Hey so I am trying to code an ellipse and I was confused about the placement of my plot. Should it be before the for loop or after?
Something like this? (I've commented out your meshgrid commands as they just confuse the plot and I'm not at all clear why they ...

1 year ago | 1

Answered
Using Euler's Method for projectile motion
A little more like this? (I've used arbitrary values for initial conditions etc.) N = 200; % points to be taken g = 9.8; % acc...

1 year ago | 0

| accepted

Answered
need plot a graph using Euler's method for both numerical and analytical
f = a + (2 - 0.4*a) * x(i) / r^2 * pi; % x(i) not just x. % Also take note of the other comments above.

1 year ago | 1

Answered
How can I create a loop to show a table with number of iterations and its roots in secant method?
Possibly like this (though using a while loop would be better): f=@(x) exp(0.5*x)+(5*x); x(1)=0.8; x(2)=0.7; tol=0.0001; ...

1 year ago | 0

| accepted

Answered
Condition for output result
Instead of x1 = x0+B; how about x1 = max(min(x0+B,5.0),0);

1 year ago | 0

| accepted

Answered
Why is my loop not ending?
Shouldn't dp(i+1)= ((6*m(i+1))/(pi*row))^(1/3); be dp(i+1)= -((6*m(i+1))/(pi*row))^(1/3); i.e. have a negative sign in front...

1 year ago | 0

Answered
Explicit solution can not be found using dsolve of second order differential equation
Do you have a reason to believe there is an analytical solution to this? It is simply solved numerically, as follows: X0 = [1,...

1 year ago | 0

| accepted

Answered
i am trying to add a legend for the 0.2% offset line onto the graph, but when i run this, the previous three legend just disappear.
Just put '0.2 offset line' as a fourth item in your other legend command.

1 year ago | 0

| accepted

Answered
Minimizing an equation to 0
Try fminsearch

1 year ago | 0

Answered
Solving for two variable.
In that case one way is to take logs of both sides to get: log(I) = log(I0) + q/(n*k*T)*U then do a best-fit straight line...

1 year ago | 0

| accepted

Answered
I couldn't plot the function because it seems vector length isn't same, please help me in it.
Try changing n = 100 for i = 1:n to n = numel(time); for i = 1:n-1

1 year ago | 0

Answered
How to plot an array graph from a 'for' loop?
Try multiplying i by delta_t in the plot command x(1) = 1; delta_t = 0.1; n = 100; for i = 1:n hold on grid ...

1 year ago | 1

| accepted

Answered
Display text label on top of grouped bar plots
See answer at your earlier question.

1 year ago | 0

| accepted

Load more