Answered
Find the sum of the vector using a for loop
If you type the expression 50:1 into MATLAB, you will get the result >> 50:1 ans = 1×0 empty double row vector So, y...

6 years ago | 0

Answered
Index exceeds the number of array elements (1)
You didn't answer Ameer's first question, but it seems clear that when you call the function diggerangle(L_12, L_23, L_13, x) %...

6 years ago | 1

Answered
How to write a custom non linear function for data fitting?
I don't have the Curve Fitting Toolbox, so I can't really comment on your current code. But, if you also have the Statistics and...

6 years ago | 1

Answered
Plot and fit exponential decay probability of population
You are correct to use the ecdf function. I think the piece you are missing is the use of the 'censoring' input. Take a look at ...

6 years ago | 0

| accepted

Answered
matlab gives wrong answer to determinant of a 3x3 matrix
MATLAB gives the correct result to within the limits of double-precision floating-point arithmetic. This is a very common quest...

6 years ago | 1

Answered
How do I print unknown values
vectorA = [2 3 5 7]; ['Vector A is: [',sprintf('%6.3f', vectorA),']']

6 years ago | 0

| accepted

Answered
How to fit multiple peaks using Gaussian funtion
Never noticed the original of this question, but saw the comment. If you have the Statistics and Machine Learning Toolbox, I be...

6 years ago | 0

Answered
Hyerbolic Functions causing issues with Contour Plots.
I ran the following code k = 0.5; l = 0.5; k1=((k+(1/2))*pi)^4; l1=((l+(1/2))*pi)^4; v1 = @(x,y) cos(k1*x)-cosh(k1*x)-(...

6 years ago | 0

Answered
make rectangular with vectors
You say that you have a problem with "one" of your lines, but I think you have a deeper conceptual problem with how you tried to...

6 years ago | 1

| accepted

Answered
what is wrong with my code, i am trying to plot below
FYI, there is a much more efficient solution, which is to avoid the for loop altogether: t = 1:.01:10; x = zeros(size(t)); ...

6 years ago | 0

Answered
what is wrong with my code, i am trying to plot below
In every iteration of the for loop, you are simply overwriting x, over and over. Instead, you need to define a vector for x, to...

6 years ago | 0

| accepted

Answered
whats wrong with my code?
He wrote dx = [0]; and you wrote dx[0];

6 years ago | 1

| accepted

Answered
Problem with find string in array
contains(cellstr(Mfg),'bmw')

6 years ago | 1

Answered
Save image containing plotted lines
I would expect print('-dpng','-r600','HoughLines.png') to work. You could also try the export_fig utility from the File Excha...

6 years ago | 0

Answered
How to save any trained machine learning model to use it for prediction later?
The standard calling syntax, e.g. Mdl = fitrensemble(Tbl,ResponseVarName); stores everything you need in the model object name...

6 years ago | 0

| accepted

Answered
Perform inverse of each double within a cell
Why do you think you cannot use cellfun? Period = {[2 3; 5 7],[11 13]}; Frequency = cellfun(@(x)1./x,Period,'UniformOutput',...

6 years ago | 0

| accepted

Answered
factoran Error, "Some columns of the X matrix are constant."
You've asked questions about three errors: some columns of the X matrix are constant the number of factors requested, M, is to...

6 years ago | 0

Answered
How can I generate a random number from a chi square distribution?
If you have the Statistics and Machine Learning Toolbox, you can use the randsample command to do weighted probabilities. In the...

6 years ago | 0

Answered
how to plot cosx*coshx+1=0
I don't have the Symbolic Math Toolbox, so I can't comment on your code. But this worked for me. f = @(x) (cos(x)).*(cosh(x))+1...

6 years ago | 0

| accepted

Answered
Which paper should be cited for the genetic algorithm used in Matlab 2019a
One source of references is the documentation for the function (which I'm guessing is where you found the reference you have). ...

6 years ago | 0

| accepted

Answered
Sparse matrix re-ordering
I tried to generalize your code as follows. A = [-1 -2 0 4 0 0 0 1 0 0; 3 2 0 0 0 0 -4 0 0 3; 0 0 5...

6 years ago | 0

| accepted

Answered
Scatter and line problem
This code illustrates everything you asked about. % Fix the random number seed, for reproducibility rng default % Data x=[...

6 years ago | 0

| accepted

Answered
Error with exponential term
You could type format long before running that code, or use the sprintf command to display the result. Looks like Kg1 is 0 to...

6 years ago | 0

Answered
Convert a cell array into matrix, but with just removing the commas (Need words to stay)
NF_array = [{'1, known, known, 0.0, 0.0'}, ... {'8, known, known, 0.0, 0.0'}, ... {'4, free, known, 0.0, 0.0' }, ... ...

6 years ago | 0

| accepted

Answered
Sparse matrix re-ordering
[sorted_nodes,index_to_sorting_order] = sort(nodes)

6 years ago | 0

Answered
Creating groups of 2 people from a cell array of names
If C is your cell array, then reshape(C(randperm(n)),n/2,2)

6 years ago | 1

| accepted

Answered
Yearly average but keeping matrix dimensions
repavgmat = repmat(mean(mat,1),[size(mat,1) 1 1]);

6 years ago | 0

Answered
Fill area between circles
Here is one way: % Get data for the two circles [xp5, yp5] = circle(5,0,0,0,2*pi,0.01); [xp10,yp10] = circle(10,0,0,0,2*pi,0....

6 years ago | 2

| accepted

Answered
Generate a Poisson random variable
Use histogram(S) instead of bar(S) and move that line out of the for loop, so you don't have to draw it 10,000 times. :-)

6 years ago | 0

| accepted

Answered
Difficulties with interpreting and use of @ sign
While waiting for the info I asked about above, I'll make a guess. Does f = @(y)((y-1).*(y-2)) work? Note that I replaced * wi...

6 years ago | 0

Load more