Answered

Solving a taylor serie with matlab. Homework question

There's a multiplier of (-1)^(i-1) that you need. Try tol=1e-8; s=0; i=1; k = -2/3; s = k; err = 1; while err > tol ...

Solving a taylor serie with matlab. Homework question

There's a multiplier of (-1)^(i-1) that you need. Try tol=1e-8; s=0; i=1; k = -2/3; s = k; err = 1; while err > tol ...

alrededor de 20 horas ago | 0

Answered

Function that should be continuous isn't continuously plotted?

The function is continuous at (0,0); it has a removable singularity. Try using [x,y] = meshgrid(-2+eps:0.2:2+eps); eps is Mat...

Function that should be continuous isn't continuously plotted?

The function is continuous at (0,0); it has a removable singularity. Try using [x,y] = meshgrid(-2+eps:0.2:2+eps); eps is Mat...

alrededor de 21 horas ago | 1

| accepted

Answered

How do I set multiple columns as the same variable?

Have you tried UT = xlsread(velocity data.xlsx, 'A3:X2883'); or whatever, the overall range values are. Then Power= 0.5*rho...

How do I set multiple columns as the same variable?

Have you tried UT = xlsread(velocity data.xlsx, 'A3:X2883'); or whatever, the overall range values are. Then Power= 0.5*rho...

alrededor de 22 horas ago | 0

Answered

differentiation in matlab of two functions

a = @(theta) exp(2j*pi*A*[cos(theta);sin(theta)]); dadtheta = @(theta) 2j*pi*A*[-sin(theta);cos(theta)]*a(theta);

differentiation in matlab of two functions

a = @(theta) exp(2j*pi*A*[cos(theta);sin(theta)]); dadtheta = @(theta) 2j*pi*A*[-sin(theta);cos(theta)]*a(theta);

alrededor de 24 horas ago | 0

Answered

Not sure what's happening in this code and not sure where to come from here.

You are not keeping track of parameters through time. Try L = 30; m = 68.1; c_d = 0.25; k = 40; gamma = 8; g = 9.81; h = ...

Not sure what's happening in this code and not sure where to come from here.

You are not keeping track of parameters through time. Try L = 30; m = 68.1; c_d = 0.25; k = 40; gamma = 8; g = 9.81; h = ...

1 día ago | 0

Answered

How to set y to different functions depending on the limits of T

Might be easier as T = -20:0.5:20; ai = 0.5; a0 = 0.3; y = ai + (a0 - ai)*((T+10)/20); id = find(T<=-10); y(id) = ai; id ...

How to set y to different functions depending on the limits of T

Might be easier as T = -20:0.5:20; ai = 0.5; a0 = 0.3; y = ai + (a0 - ai)*((T+10)/20); id = find(T<=-10); y(id) = ai; id ...

2 días ago | 0

Answered

Police increase of X/Y label in plot

I think you are referring to the Properties of the text and coordinates. You can add properties of Fontsize and Fontweight to x...

Police increase of X/Y label in plot

I think you are referring to the Properties of the text and coordinates. You can add properties of Fontsize and Fontweight to x...

2 días ago | 0

| accepted

Answered

Monte Carlo integration of f(t) = −0.1t^3 + 0.58t^2 cosh( −1/( t + 1)) + exp(t/ 2.7) + 9.6

Here's a simple MC calculation of the integration of your function f = @(t) -0.1*t.^3 + 0.58*t.^2.*cosh(-1./(t+1)) + exp(t/2.7)...

Monte Carlo integration of f(t) = −0.1t^3 + 0.58t^2 cosh( −1/( t + 1)) + exp(t/ 2.7) + 9.6

Here's a simple MC calculation of the integration of your function f = @(t) -0.1*t.^3 + 0.58*t.^2.*cosh(-1./(t+1)) + exp(t/2.7)...

2 días ago | 0

Answered

How to solve a symbolic angle for an equation without complex numbers

You could find the angle with fzero: %Input Values %Shear_max=560*(10^6); %yield stress from data sheet g_max_A=172.369*(10^6...

How to solve a symbolic angle for an equation without complex numbers

You could find the angle with fzero: %Input Values %Shear_max=560*(10^6); %yield stress from data sheet g_max_A=172.369*(10^6...

3 días ago | 0

| accepted

Answered

How can I define the variable handles for this code. A is a numerical value not text "Undefined variable handles or class "handles.A"

Do you want something like this? xo = 0.1; vo = 3; m = 1; c =10; k = 100; wn = sqrt(k/m); c_c = 2*m*wn; zeta = c/c_c; t = li...

How can I define the variable handles for this code. A is a numerical value not text "Undefined variable handles or class "handles.A"

Do you want something like this? xo = 0.1; vo = 3; m = 1; c =10; k = 100; wn = sqrt(k/m); c_c = 2*m*wn; zeta = c/c_c; t = li...

4 días ago | 0

Answered

how to solve a system of equations in matlab

Try this f = @(x) (x+2).*(x<=0) + (-x+2).*(x>0); (x<=0) returns 1's where it's true and 0 where it's false. Similarly for (x>...

how to solve a system of equations in matlab

Try this f = @(x) (x+2).*(x<=0) + (-x+2).*(x>0); (x<=0) returns 1's where it's true and 0 where it's false. Similarly for (x>...

5 días ago | 0

| accepted

Answered

Trying to plot Fourier series, but just getting a straight line??

When I run this A0=1; T=1; n=6; t = 0 : T/256 : T; nn = length(t); f = zeros(n,nn); s = zeros(nn); for ii = 1:n for j...

Trying to plot Fourier series, but just getting a straight line??

When I run this A0=1; T=1; n=6; t = 0 : T/256 : T; nn = length(t); f = zeros(n,nn); s = zeros(nn); for ii = 1:n for j...

5 días ago | 0

Answered

Wha'ts wrong with this?

Try f = @(x) sin(x+1)*sqrt(x+1); p = polyfit([1,2,3,4],[f(1),f(2),f(3),f(4)],3); x = 1:0.01:4; y = polyval(p,x); plot([1,2,...

Wha'ts wrong with this?

Try f = @(x) sin(x+1)*sqrt(x+1); p = polyfit([1,2,3,4],[f(1),f(2),f(3),f(4)],3); x = 1:0.01:4; y = polyval(p,x); plot([1,2,...

6 días ago | 2

| accepted

Answered

Trying to plot Fourier series, but just getting a straight line??

Replace f(ii) = f(ii,j) + (4*A0/(2*ii-1)*pi) * sin(2*pi*(ii-1)*t(j)); with f(ii,j) = f(ii,j) + 4*A0/((2*ii-1)*pi) *...

Trying to plot Fourier series, but just getting a straight line??

Replace f(ii) = f(ii,j) + (4*A0/(2*ii-1)*pi) * sin(2*pi*(ii-1)*t(j)); with f(ii,j) = f(ii,j) + 4*A0/((2*ii-1)*pi) *...

6 días ago | 0

| accepted

Answered

Heaviside function is not integrated

You could do it this way, without the symbolic stuff: %% Castigliano E=210e9; %e-modulus aluminium=69 steel-210 rho=8...

Heaviside function is not integrated

You could do it this way, without the symbolic stuff: %% Castigliano E=210e9; %e-modulus aluminium=69 steel-210 rho=8...

6 días ago | 1

| accepted

Answered

How would I plot a piecewise summation.

Something like this? tau = 1; t = 0:0.1:10; n = ceil(t/tau); for i = 1:numel(n) S = 0; for k = 1:n(i) ...

How would I plot a piecewise summation.

Something like this? tau = 1; t = 0:0.1:10; n = ceil(t/tau); for i = 1:numel(n) S = 0; for k = 1:n(i) ...

6 días ago | 1

| accepted

Answered

oblique throw for golf ball

A little more like this perhaps: v0 = [15:60]; %initial speed a = [15:60]; %angle g = 9.81; %gravitational acceleration ...

oblique throw for golf ball

A little more like this perhaps: v0 = [15:60]; %initial speed a = [15:60]; %angle g = 9.81; %gravitational acceleration ...

6 días ago | 1

| accepted

Answered

Using Linear congruential to generate 10,000 uniform random variables

You need an intial value for X(1); and you need to set for n=2:10000 X(n+1)=mod((a*X(n)+c), m); end

Using Linear congruential to generate 10,000 uniform random variables

You need an intial value for X(1); and you need to set for n=2:10000 X(n+1)=mod((a*X(n)+c), m); end

7 días ago | 0

| accepted

Answered

Not able to stop value of iterations

Better as something like tol = 10^-8; % or whatever you desire maxiter = 100; % ditto err = 1; its = 0; while ...

Not able to stop value of iterations

Better as something like tol = 10^-8; % or whatever you desire maxiter = 100; % ditto err = 1; its = 0; while ...

7 días ago | 0

Answered

How can I store values in empty matrix to plot later?

You need to wotk with normalized population numbers. You can renormalize at the end. %Epidemic Simulation %Author: James Metz...

How can I store values in empty matrix to plot later?

You need to wotk with normalized population numbers. You can renormalize at the end. %Epidemic Simulation %Author: James Metz...

8 días ago | 0

| accepted

Answered

Fitting multiple datasets to non-linear coupled ODE's - fminsearch

Why not just use errT=norm(cellHND - chND)+norm(cellLND - clND); instead of looping through the sums.

Fitting multiple datasets to non-linear coupled ODE's - fminsearch

Why not just use errT=norm(cellHND - chND)+norm(cellLND - clND); instead of looping through the sums.

8 días ago | 0

Answered

why is there an error in line 13 of my coding ?

In addition to Walter's correction, note that f and d contain a different number of elements, so element by element operations w...

why is there an error in line 13 of my coding ?

In addition to Walter's correction, note that f and d contain a different number of elements, so element by element operations w...

8 días ago | 0

Answered

How to plot ode

First, you should combine your three "prom" ode functions into one IC = [n0 m0 h0]; [t, NMH] = ode45(@(t,nmh) prom(t,nmh,V1), ...

How to plot ode

First, you should combine your three "prom" ode functions into one IC = [n0 m0 h0]; [t, NMH] = ode45(@(t,nmh) prom(t,nmh,V1), ...

9 días ago | 0

| accepted

Answered

Grouping In Pairs the Coefficients of an Array and Computing the Average of each group

Use reshape to get the pairs in two rows. AG = reshape(A,2,4); Then the average of each group is simply Agav = mean(AG);

Grouping In Pairs the Coefficients of an Array and Computing the Average of each group

Use reshape to get the pairs in two rows. AG = reshape(A,2,4); Then the average of each group is simply Agav = mean(AG);

9 días ago | 0

| accepted

Answered

I'm trying to solve this problem in MatLab

In terms of real numbers the integral is only defined for -1<=x<=1. By making the substitution x^2 = sin(theta) where -pi/2<=t...

I'm trying to solve this problem in MatLab

In terms of real numbers the integral is only defined for -1<=x<=1. By making the substitution x^2 = sin(theta) where -pi/2<=t...

9 días ago | 0

Answered

Plot 4 diagrams in one plot

Like this? mu=[0 0.1 1 10]; tspan=[0 20*pi]; x0=0.5;dx0=0; IC=[x0 dx0]; % initial conditions for i=1:4 dxdt=@(t,x)[x(2); ...

Plot 4 diagrams in one plot

Like this? mu=[0 0.1 1 10]; tspan=[0 20*pi]; x0=0.5;dx0=0; IC=[x0 dx0]; % initial conditions for i=1:4 dxdt=@(t,x)[x(2); ...

10 días ago | 0

Answered

Raising a negative value to a fraction power?

Exponentiation has a higher priority than negation, so -2^1.2 is -(2^1.2), this results in a negative real. On the other had (-...

Raising a negative value to a fraction power?

Exponentiation has a higher priority than negation, so -2^1.2 is -(2^1.2), this results in a negative real. On the other had (-...

10 días ago | 1

| accepted

Answered

Matrix Question for 12*12 matrix

Supposing M is the 12x12 matrix, then M([1,2,4],:)=[]; M(:,[1,2,4])=[]; should remove the appropriate rows and columns.

Matrix Question for 12*12 matrix

Supposing M is the 12x12 matrix, then M([1,2,4],:)=[]; M(:,[1,2,4])=[]; should remove the appropriate rows and columns.

10 días ago | 0

| accepted

Answered

Cant get my loop to work

Replace your k loop by for k=1:size(IC,1) [V, CT] = ode45(@fn, Vspan, IC(k,:)); figure; plot(V,CT(:,1),V,CT(:,2),V,CT(:,3...

Cant get my loop to work

Replace your k loop by for k=1:size(IC,1) [V, CT] = ode45(@fn, Vspan, IC(k,:)); figure; plot(V,CT(:,1),V,CT(:,2),V,CT(:,3...

10 días ago | 0

| accepted