Answered
add spesified value on array
x = 8e6 + 2e6*rand(1,1000) value = 3e5; x(x>9e6) = x(x>9e6) + value; x

3 years ago | 0

| accepted

Answered
How do I remove the Ans from the result
How do I remove the Ans from the result By correctly coding the if-clause: Alpha = [1,0]; if Alpha(1,1) == 1 disp('Ok') e...

3 years ago | 0

Answered
How to solve Phase Change Stefan problem with the PDEtool?
There is no chance to solve the problem with a standard tool to solve partial differential equations (like the PDE Toolbox). I ...

3 years ago | 0

| accepted

Answered
Plotting a 4D graph with the fourth dimension using color (a 3D graph with the fourth dimension represented using colors)
Use "slice". This will display R0 on predefined planes in 3d space.

3 years ago | 1

Answered
Solve a multiobjective optimization problem by problem-based approach in Matlab2021a
% teste_multiobjective file x1 = optimvar('x1','LowerBound',0); x2 = optimvar('x2','LowerBound',0); s1 = 5*x1 + 2.5*x2 >=...

3 years ago | 0

Answered
Plotting the function by the points that need to be determined
%% initial conditions global d k0 h_bar ksi m E; Ef = 2.77*10^3; Kb = physconst('boltzmann'); % 1.38*10^(-23) T = 0.12:0.24...

3 years ago | 0

Answered
How to find the maximum value of the power and its position on the time axis (x,y)?
s=1.25; t1=0:0.01:pi/2; t2=pi/2:0.01:pi; t=[t1 t2]; p1= 4*(sin(2*t1)).^2.*exp(-t1/s).^2 + 2; p2= 4*(sin(2*t2)).^2.*exp(-t2/...

3 years ago | 1

Answered
How to plot these three fucntion X,S and P in one graph with lines
t=0:0.5:14; X0=0.036; Xm=2.24; u0=1.14; S0=41.44; Ms=1.56; Yxs=0.37; Ypx=0.958; dt=0.90; X=(X0*Xm*exp(u0*t))./(Xm-X0+...

3 years ago | 0

| accepted

Answered
How to make 'for loop' for three variables (i,j,n)?
for i=1:m-1 instead of for i=2:m-1

3 years ago | 0

Answered
goodness of fit data for a fit
Statistical information about the goodness of fit can be obtained by using "fit" instead of "lsqcurvefit" and the second output ...

3 years ago | 0

Answered
why plot not generate for the following codes?
creation = 1; syms n alpha = sym(0.03); ketalpha1 = symsum(exp(-abs(alpha)^2 * alpha^n / sqrt(factorial(n)) ), n, 0, 10); ...

3 years ago | 0

| accepted

Answered
How to generate N independent, identically distributed random numbers from the Reciprocal Normal Distribution?
% Generate 10 random numbers from the inverse normal distribution % (mu=0, sigma=1) % % G(y) = 1 - F(1/y) % is the cumulati...

3 years ago | 0

| accepted

Answered
'integral' with piecewise expressions
L = 1; Beta = @(y,L) pi/2.*((0<=y) & (y<L/2)) + (pi/2+0.3491).*((L/2<=y) & (y<3/4*L)) + (pi/2-0.3491).*((3/4*L<=y) & (y<=L)); ...

3 years ago | 1

| accepted

Answered
All the combinations for 3 variables
https://de.mathworks.com/matlabcentral/fileexchange/5475-cartprod-cartesian-product-of-multiple-sets https://de.mathworks.com/m...

3 years ago | 0

| accepted

Answered
Plotting the function by the points that need to be determined
Maybe something like this ? %% initial conditions global d k0 h_bar ksi m E; Ef = 2.77*10^3; Kb = physconst('boltzmann'); %...

3 years ago | 0

Answered
Plot-Parameter study- Adsorption
I don't know whether you and Sona Ghulami are the same person, but i suggest you start with the last code under https://de.math...

3 years ago | 0

Answered
plotting a signal which has two equations
None of the two if conditions is satisfied for your t-array. Thus the array S_if does not exist after the for-loop - even if you...

3 years ago | 0

Answered
defining a fitting type
My guess is fitType = @(x,a,b,c,d,f)Even_fit(x,a,b,c,d,f,N); fit(x,y,fitType)

3 years ago | 0

| accepted

Answered
Error using sym/coeffs. First argument must be a scalar.
My guess is that VG1_0(1,1) is interpreted as a polynomial in the variable q2_hiz(t). Since your expression does not contain q...

3 years ago | 0

| accepted

Answered
I cannot give this struct as input of a custom function, how can I do?
Works without problems. Have you saved an m-file named "myfunction.m" in your working directory ? var.hold_on = 1; var.box_on...

3 years ago | 0

Answered
closest value to zero excluding the first one?
out of our list of stuff to search for ? v = [-0.1 2 4 -0.5 8]; [~,i] = min(abs(v(2:end))) v(i+1)

3 years ago | 0

Answered
how to solve one variable in non linear equation?
T=12; u1=400;u2=8;a=30;b=5;a2=100;A=500;c2=10;c3=12;c4=8;D0=115; b2=0.2; a=-1.1;d=11.2;m=-0.5;k1=1.5;k0=1.1;k2=2; syms t1 c...

3 years ago | 1

| accepted

Answered
Error using plot vectors must be the same length
You can easily test what the error is. A plot command plot(x,y) can only be successful if: x is a column vector and y is a m...

3 years ago | 0

Answered
Index exceeds the number of array elements
I suggest you insert values for p1 and solve for t1. This will be easier than the other way round. format longg syms p1 t1 nm...

3 years ago | 1

Answered
Extracting symbolic values from symbolic matrix
syms t q2(t) q3(t) a1 a2 n1 = [a1*q3(t);a2*sin(q2(t));0]; n1(2,1) % extract element (2,1) n1(2,:) % extract complete 2nd ...

3 years ago | 0

| accepted

Answered
Why du/dx obtained from excel and Matlab gives different results?
If the X grid is equidistant, dudx = gradient(U,X(2)-X(1))

3 years ago | 0

Answered
Desorption-Fixed bed- Initial conditions
Then set c0 = cFeed*ones(n,1) c0(1) = 0.0; q0 = qFeed*ones(n,1) as initial and boundary conditions of the desorption, if thi...

3 years ago | 0

| accepted

Answered
plot a function wit cos
f=(0:10); %f0=5*10^9; c=(3*10^8); t=5*10^9; w=2*pi*f; wt=w*t; k=(wt/c); z=(0.75:30); r12=0.29; %x=0.094*cos*(k*z); y=0...

3 years ago | 0

Answered
How to fix error in my DAE program?
The call to ode15s is incorrect: [t,y] = ode15s(@(t,y) reduced21(t,y,T_a),tspan,y0); instead of [t,y,ydot] = ode15s(@(t,y,ydo...

3 years ago | 0

Answered
How to generate matrix from iterations?
V1 =[0 20 60 80 100]; V2 =[20 60 80 100]; itermax = 10; for i = 1:numel(V1) v1 = V1(i); for j = 1:numel(V2) ...

3 years ago | 0

Load more