Answered
How can I reshape single column vector list into equally sized matrix columns
s = mod(26599,512); n = 26599 - s; m = n/512; R = horzcat(reshape(sample_test(1:n),512,m),vertcat(sample_test(n+1:end),NaN(51...

10 Tage ago | 0

Answered
Solving a discrete logarithm problem returns a 0x1 sym or Unable to find explicit solution
Brute force: x = 0:24; y = uint64(6.^x); d = mod(y,11); x = x(d==2)

10 Tage ago | 0

Answered
Why do I receive this error when using cumsum: "Invalid data type. First input argument must be numeric or logical." ?
Try this: function main file_name = 'sample_test.txt'; H = dfaedit(file_name,1,1,1) end function [H]=dfaedit(file_...

11 Tage ago | 0

Answered
How can you change the bounds used by a solver with each iteration?
Use "fmincon" instead of "lsqnonlin" and change the bounds in "nonlcon".

11 Tage ago | 0

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

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

11 Tage 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; ... ...

11 Tage ago | 1

| accepted

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

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

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

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

11 Tage ago | 0

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).';(...

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

14 Tage ago | 0

| accepted

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

14 Tage 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 = ...

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

17 Tage 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).

17 Tage 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(...

17 Tage 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)...

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

18 Tage 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 ?

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

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

19 Tage 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);...

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

20 Tage 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 =...

21 Tage 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)...

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

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

22 Tage ago | 0

| accepted

Load more