Answered
How to plot the graph of y=ax+b?
x=0:0.1:50; y=53.5*x-1354.5; plot(x,y)

4 years ago | 0

| accepted

Answered
Storing function outputs to an array so they can be plotted
A = 1:20; H_l = 2*(A+1); Sig_Lambda = 1*10^-9; I = A.*H_l*Sig_Lambda; plot(Lambda,I) works if Lambda is a sorted 1x20 ve...

4 years ago | 1

| accepted

Answered
how can i make a general matrix?
function main L = [1 2 0.1 0.2 0.02; ... 1 4 0.05 0.2 0.02; ... 1 5 0.08 0.3 0.03; ... 2 3 0.05 0.25 0.03; ... ...

4 years ago | 1

| accepted

Answered
Remove Zeros Matrix on 3D Matrix
function main val = rand(2,3,4) val(:,:,3) = [] end

4 years ago | 0

Answered
Plot the Poisson CDF with the Standard Normal Distribution CDF
I suspect the graphics shows that the arithmetic mean of normalized independent Poisson random variables converges in distributi...

4 years ago | 0

Answered
how can i change the dimension of the matrix?
You must first decide where you want element (i,j,k) of the old matrix be placed in the new matrix. But usually MATLAB's "resha...

4 years ago | 0

Answered
how to calculate a difference of function with any parameter
function main h = 1e-6; xleft = -pi; xright = pi; n = 200; dx = (xright-xleft)/n; x = xleft:dx:xright; chan...

4 years ago | 0

| accepted

Answered
the projected distances between the line and edge A
You will have to check for correctness: % Project p1 on plane ABC (gives point p1-proj) Mat = [(B-A)*(B-A).' , (B-A)*(C-A).';(...

4 years ago | 0

| accepted

Answered
Coding a system of differential equations
Numerically solving the original system will make difficulties because of the singularity at t=0 for y. So let's first rewrite ...

4 years ago | 0

| accepted

Answered
Product of vector elements where the vector has a large size
Product_V = exp(sum(log(V(1,:)))/numel(V))

4 years ago | 0

| accepted

Answered
The output of ode45 does not make much sense
function main n0 = 1.0; %assume value for n(0) epsilonmax0 = 10; %assume value for epsilonmax x0 = ...

4 years ago | 0

Answered
Runge kutta 4 probelm
function main g = 9.81; m = 71; k = 1000; l_0 = 8; tstart = 0.0; tend = 10.0; h = 0.01; T = (tstart:h:te...

4 years ago | 1

Answered
One of the constant input variable need to be changed based on previous step's output in ODE, Can anyone kindly help?
Either you insert some delay elements (PT1 or similar) or you have to solve a delay differential equation (e.g. using dde23).

4 years ago | 0

Answered
Given an equation and data points, find the best fit coefficients of the equation
x = 0:5; y = [1 3 9 27 81 243]; A = [ones(6,1),exp(x.')]; b = y.'; a = A\b; f = @(x) a(1)+a(2)*exp(x); plot(...

4 years ago | 0

| accepted

Answered
Why is ySol(t) = Dsolve(ode,cond) wrong? What should it be instead?
syms Cs t y(t) ode = diff(y,t) == 40*Cs-40/280*y; cond = y(0) == Cs; ySol(t) = dsolve(ode,cond); ysol_num = subst(ySol,Cs,C)...

4 years ago | 1

Answered
Utilizing the Euler Method
In the if-statement in Flight.m, set x3 to x(3,i-1) and calculate the other variables x4,x5,f,u1,u2,u3,V_ver,C_D,Cl and p only f...

4 years ago | 0

| accepted

Answered
Anisotropic f coefficient for PDE solving
Maybe page 2-79 under http://uk.mathworks.com/help/pdf_doc/pde/pde.pdf ?

4 years ago | 0

Answered
how to solve this motion equation?
function main y0 = [0 pi/2 0 pi/2]; %[y1 y2 y3 y4]=[theta1 theta1dot theta2 theta2dot] tspan = [0 144*pi]; [T,Y] = ode...

4 years ago | 0

Answered
How can I solve this differential equation?
function main %% defining parameter P = [80;120;100;80;120;80;120;100;80;120;80;80;100;120;100]; % Pressure, bar T = [8...

4 years ago | 0

Answered
Solve a system of ODEs with varying coefficients
function dyds_x = xcomp(sx, yx, s, kappa, tau) kappax = interp1(s,kappa,sx); taux = interp1(s,tau,sx); dyds_x = zeros(3,1);...

4 years ago | 0

Answered
Euler and FD method
function main v=10^4; % cm/s D=2; %cm c=0.099; %cm^-1 b=0.097; %cm^-1 dx=1; %cm Diffrence for x dt=0.248; a=50; %cm ...

4 years ago | 0

| accepted

Answered
Problems with the application of Newton's method
function main %UNTITLED Summary of this function goes here % Detailed explanation goes here x0 = 20; maxiter = 200; tol =...

4 years ago | 1

| accepted

Answered
select a range of coefficients of a polynme
What do you mean by "gives me coefficient from 1" ? If you want to suppress the coefficient of x1^5, use c = coeffs(Polynome)...

4 years ago | 0

| accepted

Answered
How to write the linear equations in the form of matrix
If you want it fast, you will have to define the matrix once by hand. Number the unknowns U1 = u_{0,0}, U2 = u_{0,1},...,U(N+1...

4 years ago | 0

Answered
Solving a system of ODEs whose coefficients are piecewise functions
function main T = []; Z = []; z0=[0.001 0.001]; tspan1 = [-10 -1]; iflag = 1; [t,z] = ode45(@(t,z) systode(t,z...

4 years ago | 0

| accepted

Answered
How to solve a system of integro differential equation using numerical method?
function main tspan = [0 10]; y0 = [1; 1; 0; 0]; [T,Y] = ode45(@fun,tspan,y0); plot(T,[Y(:,1),Y(:,2)]) end function dy =...

4 years ago | 0

Answered
Interpolating various dimension matrix
F = scatteredInterpolant(x(1,1:54),x(2,1:54),y(1,1:54)); y_q = F(x_q(1),x_q(2))

4 years ago | 0

| accepted

Answered
Writing an equation in terms of specific variables where relationship is known.
syms m a b t r t_eq = solve(r - a*b*t^2==0,t); r = a*b*t^2; F = m * diff(r,t); F = subs(F,t,t_eq)

4 years ago | 0

| accepted

Answered
Write a MATLAB implementation that applies the classical fourth order RK method
Here is your corrected code: B=4; f1=@(t,u,v) v; f2=@(t,u,v) 5*exp(-2*t)-2*exp(-(B+2)*t)+exp(-(B*t))+t-v*exp(-B*t)-u; f_exac...

4 years ago | 0

| accepted

Load more