Answered
How to sample from a dataset using a normal distribution as a sampling scheme?
You cannot. A normal distribution is inherently a continuous distribution with infinite tails in both directions. You are trying...

3 years ago | 0

Answered
Passing dependence on variable through nested symbolic functions
syms f1(x); f1(x) = 2*x; The first of those lines is equivalent to clear f1 x x = sym('x'); f1 = symfun('f1(x)', x); and t...

3 years ago | 0

Answered
Why did I see two licenses after purchasing the students License?
Master License is roughly "customer number". All of your individual licenses are linked to one license representing "you". So f...

3 years ago | 0

| accepted

Answered
filling a matrix using for loops
Rmax=10; Rcyl=.5; Uinf=1; Nr=50; Ntheta=50; theta=linspace(0,2*pi,Ntheta) %discretize dr=(Rmax-Rcyl)/(Nr-1); dtheta= 2...

3 years ago | 0

Answered
How to write as symbolic piecewise function with conditions on a symbolic vector
n = 4 syms Xi [1 n] condition = fold(@and, abs(Xi)<=1) ff = piecewise(condition, sum(Xi.^2), Inf)

3 years ago | 0

| accepted

Answered
I am looking for drawingmesh.m
It is in https://drive.google.com/drive/folders/1cOWr7HoQ73nNtphFzMgdy_pECKGp-VWg and https://storage.googleapis.com/sgw-extras...

3 years ago | 3

| accepted

Answered
How to put non repeated elements of a symmetric matrix in a row vector?
In the special case where the diagonal is zero, see squareform()

3 years ago | 1

Answered
Index in position 1 is invalid. Array indices must be positive integers or logical values?
ismember returns 0 for indices in the case that the value was not found. Note that the entries in Tyrseq have *not* had trail...

3 years ago | 0

Answered
solve 2 equations with two sympolic variables
Those are independent equations. Over the reals they have one solution each. U20=0, U10=1

3 years ago | 0

Answered
Question about sine block in simulink
https://www.mathworks.com/help/simulink/slref/sinewave.html https://www.mathworks.com/help/dsp/ref/sinewave.html (discrete on...

3 years ago | 0

Answered
How to save each result of objective function solved by genetic algorithm for each iteration?
Yes, of course. numiter = 50; results = zeros(nvars, numiter); fvals = zeros(1, numiter); for iter = 1 : numiter [re...

3 years ago | 0

Answered
When calling functions which use themselves, am I bogging down the processor?
Does this mean that MATLAB is keeping the functions open which created test? When you create an anonymous function and the body...

3 years ago | 1

| accepted

Answered
Export from pdf to matlab
https://www.mathworks.com/help/textanalytics/ref/extractfiletext.html -- requires the Text Analytics Toolbox See also https:/...

3 years ago | 0

| accepted

Answered
How to create function handle using random output
For fmincon and simulannealbnd the easiest way to handle this is to use the same function call in each case, but set the ub and ...

3 years ago | 0

Answered
How to bubble sort incorporating deal function
a = 3; b = -2; [a,b] [a,b] = deal(b,a) [a,b] However in context, x = [3, -2] x(1:2) x(1:2) = x([2 1]) x(1:2) When you a...

3 years ago | 0

Answered
Using FLIR thermal camera with matlab
The acquired frames are intensity images -- grayscale. 2D arrays. imshow(frame) of a 2D array automatically tells MATLAB to use...

3 years ago | 0

| accepted

Answered
When copying plot from one subplot position to another using copyobj, the second plot exhibits "hold on" behavior while the first doesn't.
None of the low-level graphics operations pay attention to the hold state; they just add to (or modify) what is there already. T...

3 years ago | 0

| accepted

Answered
lsqnonlin providing very poor model fits
Your code is incorrect. You have a shared variable "i" that you increment each time t>10*u and you use i to select coefficients....

3 years ago | 0

Answered
Does the use of name-value arguments in functions slow down the speed of my code?
Yes, of course argument processing takes execution time. MATLAB does *not* somehow cache the results of the argument processing ...

3 years ago | 0

| accepted

Answered
I am having a hard time getting the matrix multiplication to work due to incompatible matrix sizes.
You have problems with the / operation. / is matrix division with A/B being similar to A * pinv(B) You need element by elemen...

3 years ago | 0

Answered
Unrecognized function or variable 't' for three dimensional structure
idx_QD = @(t) (fz(t) >= z0).*(((x(k)-x0)/Rx).^2 + ((y(j)-y0)/Ry).^2 + ((fz(t)-z0)/Rz).^2 < 1); idx_WL = @(t) (f...

3 years ago | 0

| accepted

Answered
Create a point with a number inside
viscircles() and text() Or possibly use a quite large 'o' marker, and text() Or create patch objects with face color white...

3 years ago | 0

Answered
What does this error means " Interface.472C18A0_2603_11D1_9B33_0000C07EE8F2/Run2"?
each time you start a session with aspen2 a UUID (universally unique identifier) is created to distinguish this session from all...

3 years ago | 0

| accepted

Answered
I keep getting the same error for the wnlfit even after deleting and redownloading it. How can I fix this?
The code calls nlinfit which requires the Statistics toolbox to be installed and licensed. https://www.mathworks.com/help/st...

3 years ago | 0

Answered
The matlab code does not display the graph with Matlab R2015a
If I recall correctly, back in R2015a, fplot did not yet apply to symbolic expressions. That symsum() to infinity does not find...

3 years ago | 1

| accepted

Answered
(matlab coder)Generating C++ code for scalar string results in a garbled last character?
That's probably a NUL character, binary 0 , You should test it to see what the binary value is.

3 years ago | 0

| accepted

Answered
Bessel Function Calculation in Matlab
Are you sure that you want to be totaling from z = 11 to z = 60? You only set JnE to zero before the z loop. You are running in...

3 years ago | 0

| accepted

Answered
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and function body must be sym expression.
syms v2 v3 I2 v1 = 20; v1 is numeric. v2 and v3 and I2 are symbolic. eq1(v1,v2,I2) = v1.*(del_t/(2*L)) - v2.*(del_t/(2*L))+ I...

3 years ago | 1

Answered
Need to store data every loop
I will not run the program to that point because of some issues that I recommend be fixed first. Your code has for p = range2 ...

3 years ago | 1

| accepted

Answered
Using roots() and poly() for multivariable functions
[N D] = numden(Eqn) sol = root(N, z_1) You will get root(4*z_1*z_2^2 - z_1 - z_2 - 2*z_2^2, z_1) But you would hav...

3 years ago | 0

Load more