Answered
How to count steps represented by the acceleration data given in text file?
Like this (you can plot the other two - look up help on subplot): M = csvread('walking.txt'); x = M(:,1); y = M(:,2); z = M(:,...

1 year ago | 0

| accepted

Answered
Bisection method add iteration table into my code
Something like this? my_fun = @(x) exp(x) - 3*x; low = 0; high = 1; tolerance = .00001; [x, x0] = bisection(my_fun, low, hi...

1 year ago | 0

Answered
I'm trying to solve this code for internal ballistic using ode45.This is my first time using ode
This works (note that Matlab doesn't accept implied multiplication), but doesn't look sensible - what about deriv(2)? y_initial...

1 year ago | 0

| accepted

Answered
Error with brackets symsum
Do you mean something more like this? N = 100; % Total number of particles one = 1; alpha = 1; K = 7; % 7 states n0 = 4*o...

1 year ago | 0

Answered
How to plot the figure in LT?
Use the mod function help mod

1 year ago | 0

Answered
How to deal with rounding error in this example?
How about i = 1:20001; A = -2000 + (i-1)*0.2;

1 year ago | 1

Answered
Get back variables out of function inside a for loop
Here's one way J = [2.5 27 56]; WZ = [12.2 23.2 33]; M1 = 22; I1 = 2600; for ii = 1:numel(WZ) slope(ii) = (J(ii)-M1)...

1 year ago | 1

| accepted

Answered
Plot dispersion curves using Bloch theorem
Like this? OmegaR = 1; mR = 0.125; Omega = 0:0.01:2.5; mu = acos(1 - Omega.^2.*(1+mR./(1-Omega.^2/OmegaR^2))/2); plot(i...

1 year ago | 0

| accepted

Answered
how to do sensitivity analysis of three variables using MATLAB
Depends what your measure of sensitivity is. One possibility is to do a Monte-Carlo simulation and use the standard error on th...

1 year ago | 0

| accepted

Answered
MATLAB doesn't plot my function
Try fplot(test1)

1 year ago | 0

| accepted

Answered
I am trying to plot the each value of C at different theta values, but I found an error. Error: Invalid expression. When calling a function or indexing a variable, use parenth
Do you want something more along the following lines? c=[0.5,0.75,1,1.1]; theta=-pi:0.01:pi; %a=zeros(1,629); for k=1:numel(...

1 year ago | 0

Answered
Trying to make euler's method program work
Like this: % Arbitrary values here - insert your own x0 = 0; x_end = 10; h = 0.1; y0 = 1; n = fix((x_end-x0)/h)+1; ...

1 year ago | 0

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

2 years 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_...

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

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

2 years 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)...

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

2 years 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) ...

2 years 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]; ...

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

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

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

2 years 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; %...

2 years ago | 2

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

2 years 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]; ...

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

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

2 years ago | 1

Load more