Beantwortet
How to evaluate a symbolic expression having `max` and `diff`?
Use max(x,0) = 0.5*(abs(x)+x) for real x. syms x1 f1 = max([0, (7*sin(4*pi*x1))/10], [], 2, 'omitnan', ~in(x1, 'real')) ...

mehr als 2 Jahre vor | 0

Beantwortet
Curve fitting of a portion of a plot and linear equilibrium of both plots
How do I curve fit of after equilbrium points in electron temperature profile so that they both equilibriate in a single line ?...

mehr als 2 Jahre vor | 1

| akzeptiert

Beantwortet
How to make a local function that returns a vector
% parameters N=100; div=0.1; p=sqrt(3); q=0.5; r=2; % Initial values astart=5; bstart=0.1; % function [a,b]=fcn2(N...

mehr als 2 Jahre vor | 1

| akzeptiert

Beantwortet
I cannot get fplot to plot my piecewise function past an x-axis value of 5
syms t %declare a symbol voltage_values = piecewise(0<=t<=3,25,3<t<=6,0,6<t<=7,-75); fplot(t,voltage_values,[0 7]) %xlim([0 7...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
Trying to Solve quadratic inequalities
Don't expect that MATLAB succeeds for complicated systems of quadratic inequalities. But for this simple one, it returns a solut...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
Multivariable Integration w.r.t to 1 variable: 2nd variable is a function of 1st
If y is a function of x, your integrand equals F(y(x~))*y'(x~) dx~. Thus your integral equals integral_{x~=f_lower(x)}^{x~=f_...

mehr als 2 Jahre vor | 1

| akzeptiert

Beantwortet
Solving a matrix equation with fixed point iteration method
main() function main clear; clc; format long % parameters of equations: E = 1; n = 0.1; u = 0.2; % parameters of this ...

mehr als 2 Jahre vor | 1

| akzeptiert

Beantwortet
newton raphson methon and symbolic functions
Better differentiate your function with respect to h in advance and pass the result to "dvolume" so that you only need to substi...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
Specify boundary conditions for each node - Thermal problem
Supply your array or matrix "Data" as an additional input to "mygfun" and "myqfun" and use interpolation to supply the values fo...

mehr als 2 Jahre vor | 0

Beantwortet
Subs Error while using solve function
You will have to find criteria to sort out the solution you want. E.g. for real solutions only you could use syms R P = 10; e...

mehr als 2 Jahre vor | 0

Beantwortet
I estimate my desired vector with the given code but can't when.....
As you can see, the difference between xo and the noise-added xo is quite large. Thus you can expect that the difference in the ...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
Optimization problem with array input
You might want to try "intlinprog" with x being a binary vector with x(i) = 1 meaning: ball i is picked and x(i)= 0 meaning: bal...

mehr als 2 Jahre vor | 1

| akzeptiert

Beantwortet
Creating a for loop based on a condition
i = 0; tolerance = 1e-4; imax = 100; output = 1; value = ...; while abs(output-value) > tolerance && i < imax i = i + ...

mehr als 2 Jahre vor | 0

Beantwortet
Failure in initial nonlinear constraint function evaluation. FMINCON cannot continue.
You forgot to include "RCbeamdata.xls". And you know that you fix x(2) to x0(2) if you set lb(2) = ub(2) = x0(2) ? And you mus...

mehr als 2 Jahre vor | 0

Beantwortet
error updating function line
This code plots O(i): k=3500; m=5; c=270; a=0.75; T=1.5; w=2*pi/T; g=9.81; syms t a1=2734; a2=-6718; a3=5682; a4=-1...

mehr als 2 Jahre vor | 0

Beantwortet
Convection-Diffusion-Reaction Equation ( 2D) with a given Constrained Optimal Control Problem
What do you want to control with which constraints and how ? Optimal control problems together with ordinary or partial differe...

mehr als 2 Jahre vor | 0

Beantwortet
finding fit parameters between two functions
Make a function that - given tau and the parameters you want to fit - returns I_m(tau). Then look at the examples for "lsqcurve...

mehr als 2 Jahre vor | 2

| akzeptiert

Beantwortet
Syntax for optimization with integer and continuous variables, nonlinear equalities and inequalities?
Concerning your attempt with "ga": See the Note below from the documentation of "ga": x = ga(fun,nvars,A,b,Aeq,beq,lb,ub,nonl...

mehr als 2 Jahre vor | 1

Beantwortet
issue with simple nested integration of several variables
The problem with integral/integral2/integral3 is always that they call your function not with scalar arguments for the independe...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
How to use Cartesian coordinates to create Grid Surface?
If the CAD file describes the surface of the body in question, there should be a value for the elevation associated with each (x...

mehr als 2 Jahre vor | 0

Beantwortet
Solving an integral within a partial derivative
You have to solve a second ordinary differential equation for y: dy/dt = 2*Ste * theta_f*(1-Ste/3 * theta_f + 7/45*Ste^2*theta_...

mehr als 2 Jahre vor | 0

Beantwortet
How to use a user defined function inside the curve fitting function?
Use "lsqcurvefit". There are lots of examples under https://uk.mathworks.com/help/optim/ug/lsqcurvefit.html that show how to ...

mehr als 2 Jahre vor | 0

Beantwortet
Why does the vectorized function give wrong result?
Compare Fun1 and Fun2. In Fun1, xo is computed using u while in Fun2, both xo and xe are computed using b. Further, the sorting ...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
what happens behind "/"
If x = [2 3 4 5 6] and y = [3 4 5 6 7], then x/y determines the number "a" for which the error when approximating x by a*y is mi...

mehr als 2 Jahre vor | 2

| akzeptiert

Beantwortet
The function is debugging too long...
But the secant method is very different from your code - something like this: clc, clear all, close all x1=linspace(-pi/2,p...

mehr als 2 Jahre vor | 0

Beantwortet
solving system of equations
I wonder what you expect as solution for 1 equation with 7 unset parameters. Say you have the equation g = x + c1 + c2 + c3 +...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
Error using plot for Fourier series
I'm not sure what you try to do. Maybe something like this: clear all syms x L = 2; f = piecewise(x<=L/2,x,x>L/2,(L-x));...

mehr als 2 Jahre vor | 0

Beantwortet
How to vectorize the following piece of code by removing the two for loops?
clear all;clc u=[3 4 30 50];% Desired Vector b=u; [R,C]=size(b); P=C/2; M=2*C; k = (1:M).'; i = (1:P); xo = sum(1*exp(1i...

mehr als 2 Jahre vor | 0

| akzeptiert

Beantwortet
how to express operators in symbolic algebra
Maybe like this syms x syms P(x) q(x) q(x) = x^2 P(x) = diff(q(x),1) + 5 ? You can't define P as a function of a dependen...

mehr als 2 Jahre vor | 0

Beantwortet
what is different between the codes?
In both cases, you want to solve one equation in three symbolic variables (x,K,M). In your first code, MATLAB is able to determ...

mehr als 2 Jahre vor | 0

| akzeptiert

Mehr laden