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

Answered
Nonlinear Data-Fitting
% Prescribe arrays K = ...; X = ...; L = ...; Y = ...; % Define function fun = @(a,b,c,d,h) K.*log(a./(a-X)) + K/b.*log(X/...

4 years ago | 0

| accepted

Answered
Error "Supplied objective function must return a scalar value."
The function you pass to fmincon returns a vector of values, not a scalar. Maybe you mean f=@(a) norm(sum(((a(1).*(G(x,:)+m)+...

4 years ago | 0

| accepted

Answered
Problem writing fminsearch function
Here is a solution without optimizers: % Define lower and upper bounds for P1, P2 and P3 lb1 = 2000; ub1 = 4000; lb2 = 2000;...

4 years ago | 0

| accepted

Answered
Save the values in if-else
for n=1:length(week) if myorder(n)>=30 ordercost(n)=(myorder(n))*(60-(0.1*60)); else ordercost(n)=(m...

4 years ago | 0

| accepted

Answered
fsolve exitflag -2, 9 equations 9 variables
delta_lambda = 0.1; lambda_start = delta_lambda; lambda_end = 1.0; lambda = lambda_start:delta_lambda:lambda_end; n = numel(...

4 years ago | 0

| accepted

Answered
Solving multiple PDE with using PDEPE
L = 1500; %lenght x = linspace(0,L,1501); %x values from 0 to 1000 and dx...

4 years ago | 1

| accepted

Answered
how to define the range with variable
h_H2 = 0; h_O2 = 0; h_H2O = -241827; s_H2 = 130.59; s_O2 = 205.14; s_H2O = 188.83; T_ref = 298; T = 293:1173; n = 2; F ...

4 years ago | 0

Answered
When solve ODEs return NaN value
The command Cgd=interp1(vds2,crss,x(4)); in odefun2 returns NaN. The reason is that x(4) > 400 and you only have specified cr...

4 years ago | 1

| accepted

Answered
Indefinite integral for a step function with variable number of steps
The definite integral between a and b where mesh(1) <= a < b <= mesh(end) can be computed as for every other function as value_...

4 years ago | 0

| accepted

Answered
Solving a system of coupled diferential equations using ODE15s
Use ODE15I instead of ODE15S. Or use "fsolve" or "linsolve" to explicitly solve for x', y' and z' in the function where you re...

4 years ago | 0

Answered
Extend bvp4c for bvps
If you have to refer to x(t-Ts) and u(t-Ts), you have a delay differential equation. Take a look at DDE23 if it fits your needs...

4 years ago | 0

Answered
solving system of equation in for loop
Tb = (Te*(B-A)+A*C*I)./(1-A*(D-1./I)); Ta = (Tb-B*Te)/A;

4 years ago | 0

Answered
Getting same final value for various time-steps
for k=1:7999 for i=2:m-1 for j=2:m-1 T(i,j,k+1)=1/(1+2*r)*(r/2*(T(i-1,j,k+1)+ T(i+1,j,k+1)+ T(i,j+1,k+1)...

4 years ago | 0

Answered
Solver stopped prematurely. No integer feasible point found
I get the following solution 0. - 159.2453 0. - 124.7959 0. 0. -...

4 years ago | 0

Load more