Answered
Product calculation between two matrixes
X_QPSK = repmat(X_QPSK,1,400); Range_compression=surv_matrix.*conj(X_QPSK); .* multiplies each element of surv_matrix with eac...

4 years ago | 0

| accepted

Answered
How to find x value for certain y value of a lineplot in matlab
EV = EV(5:14); P = P(5:14); EV_05 = interp1(P,EV,0.5)

4 years ago | 2

| accepted

Answered
Integration takes time too long
X=-2:0.1:6; y=0.4; t=0.75; v=1.5; alpha=0.1; for i=1:numel(X) x = X(i); Fun = @(r)fun(r,x,y,t,v,alpha); C(i)...

4 years ago | 0

| accepted

Answered
Numerical simulation with symbolic expressions
syms gamma alpha b expr = gamma^2*alpha + log(b); expr = matlabFunction(expr,'Vars',[gamma alpha b]); gamma = 0:0.1:1; alpha...

4 years ago | 0

Answered
Curve fitting of transcendental equation with lsqcurvefit
Xdata=GWM_viscosity'; Ydata=GWM_f_out'; predictedzeros = @(x) Ydata + sqrt(k_val)./sqrt(m_canti_val+x(2)*B_val*Gap_val*L_val...

4 years ago | 0

| accepted

Answered
How to introduce a constraint and stop condition in ode45 ?
First question: You can't prescribe a constraint for a solution variable of an ODE. The ODE variable results automatically from...

4 years ago | 2

| accepted

Answered
Array Operations give me a constant
D0 = 100; D1 = 80; D2 = 80; HD = 0.4; A = -6.96*log(D1/D2)/D0; % A is 0 for symmetric bifurcations B = 1 + 6.98*(1-HD)/D0; ...

4 years ago | 0

| accepted

Answered
simplifying an algebraic expression in 6 variables
fun = @(x) sum( (y - A.'*x - K*sqrt((B.'*x).^2 + (C.'*x).^2) ).^2 ); Aeq = ones(1,6); beq = 1; lb = zeros(1,6); ub = ones(1,...

4 years ago | 0

| accepted

Answered
Solving the linear equation
M = T*P.'*inv(P*P.') is the least-squares solution. But you cannot expect that T=M*P is exactly satisfied.

4 years ago | 0

Answered
Implementing vectorial equation with matrix as variable
c^(D*i) is a 2x2 matrix. Thus [a0;b0]*c^(D*i) is not defined. Maybe you mean c^(D*i)*[a0;b0] or [a0,b0]*c^(D*i) ? I implemented...

4 years ago | 0

| accepted

Answered
Finding the index of elements of a vector in a mesh quite fast
mesh=linspace(0,10,10^6); A=0+(10-0).*rand(1,10000); N=1000; tic; for n=1:N y = discretize(A,mesh); idx = A-mesh(y) ...

4 years ago | 0

| accepted

Answered
Curve Fitting Toolbox with multiple variables
lsqnonlin and lsqcurvefit allow to prescribe lower and upper bounds (lb,ub) on the parameters: x = lsqnonlin(fun,x0,lb,ub,optio...

4 years ago | 1

| accepted

Answered
How can I change this code to euler backward method? (implicit method)
f = @(t,y) -100000*y + 99999*exp(-t); t0 = 0; y0 =0; h = 0.01; tn = 2; n = (tn-t0)/h; t(1)=t0; y(1)=y0; ...

4 years ago | 0

| accepted

Answered
Something wrong in the plotting
Only the continuous line is visible in Release R2022a. V1 = @(r,w) -acosh(10*(w./(1600*r + 21)).^(1/2))/20000000000; V2 = @(r,...

4 years ago | 0

Answered
Code gives Loop function error
t = 0:0.1:0.5; F = 500 - 1000*t;

4 years ago | 0

Answered
reversing the lookup table for flux based pmsm modelling, how to reverse the data Ψd(id,iq) , Ψq(id,iq) into id( Ψd, Ψq) and iq( Ψd, Ψq).
Use "fsolve" to solve for id, iq given psi_d, psi_q. In other words, solve the two equations psi_d(id,iq) - psi_d_given = 0 p...

4 years ago | 0

Answered
Array indices must be positive integers or logical values.
if rand < prob_prod % Defines whether production takes place based on Monte Carlo method. x_nr(t_nr)=x_nr(t_nr-1)+1; % Impl...

4 years ago | 0

Answered
How can I interpolate data obtained from two different time intervals?
load_fine = interp1(t_coarse,load_coarse,t_fine) where t_coarse is the time vector for the load data and t_fine is the time vec...

4 years ago | 0

Answered
How to choose an element from a vector with not equal probabilities?
A=[10 70 30 100]; P=[0,cumsum(A)/sum(A)] R = rand(10,1) Y = discretize(R,P) Rand = A(Y)

4 years ago | 0

| accepted

Answered
Why doesn't my figure show?
a=0; b=0.5; m=0.2; v=0.5; pi=0.02; f=zeros(1,20); p(1)=0.01; for i=2:20 if i<=5 f=0.04; elseif 6<=i ...

4 years ago | 0

| accepted

Answered
Equalising the number of points in a graph
X = sort(union(xgraph1,xgraph2)); ygraph1 = interp1(xgraph1,ygraph1,X,'linear','extrap'); ygraph2 = interp1(xgraph2,ygraph2,X,...

4 years ago | 1

| accepted

Answered
How to input multiple value of 'lbar' like 0.1, 0.2 , 0.3 and multiple value of 'sigma' like 0.1, 0.15, 0.2 to obtain multiple output values of W?
% For plane slider: H = Ho + a(1-x) Ho = 1; alpha = 0.1; eps = 0.1; a = 1.0; LBAR = 0.1:0.01:0.3; SIGMA = 0.1:0.01:0.2; r...

4 years ago | 0

| accepted

Answered
After this I want to integrate P1 from 0 to x (let's say this function to be P2) and then again integrating the function P2 from 0 to 1. I don't know how to proceed.
% For plane slider: H = Ho + a(1-x) Ho = 1; alpha = 0.1; eps = 0.1; a = 1.0; lbar = 0.1; sigma = 0.05; H = @(x) Ho + a*(1...

4 years ago | 0

| accepted

Answered
Three nonlinear equation with initial guess
fun = @(x,y,z)[-0.06*(x^2)-1.06*(z^2)+3.18*x+3.18*z+1.59*y-2.06*x*y-3.12*x*z-2.385-1.06*y*z;2.63*(x^2)-1.63*(y^2)-2.63*(z^2)-3.9...

4 years ago | 1

Answered
plot a surface for g-f=0
The "surface" f-g = 0 is a one-dimensional manifold in the y/z - plane and you get the corresponding curves using the "fimplicit...

4 years ago | 0

Answered
How to apply gradient metod to a single variable optimization problem
As you can see, without giving values to Cp, Cs, tau, Kp, Kop and Kr, you cannot solve for the critical points of Jd since you h...

4 years ago | 0

| accepted

Answered
how can i repeat the function using iteration
MAXRWRD = -Inf; itermax = 30; iter = 0; while MAXRWRD < 30 && iter < itermax iter = iter + 1; D = zeros(size(L)); ...

4 years ago | 0

Answered
Difference between spline(x,y,xq) and interp1(x,y,xq,'spline')
https://de.mathworks.com/matlabcentral/answers/195649-fast-interp1-with-spline

4 years ago | 0

| accepted

Answered
heat equation pde is subject to the initial conditions at t=0 and to nonhomogeneous Neumann boundary conditions. i have mistake in finding the error vector as function of time
%Implementation of FTCS for 1-D paracolic problem with NN boundary conditions % u_t-cu_xx=f(x,t), % where a<x<b and t>...

4 years ago | 0

Answered
How to generate a matrix with random numbers between 0 and 1 and mean of the distribution is unspecified.
If you choose the number of random numbers large enough, their mean should approach 0.5: n = 20000; y = rand(n,1); ym = mean(...

4 years ago | 0

Load more