Answered
How to get the R (not R^2) from a linear regression 'poly1'?
Assuming you just want the correlation coefficient of the data, you don't need the model: corrcoef(x,y)

4 years ago | 0

| accepted

Answered
Solve unknow array/matrix
% Input B = [3 0; 0 2]; C = [1 2 3; 4 5 6]; % Solve for A A = B\C % Verify B * A

4 years ago | 1

Answered
Inverse of matrix is wrong?
Looks fine to me: val=zeros(1,583); j=[10,10E-1,10E-2,(9:-1:1)*(10^-3)]; val(1:12)=j; sum_val=sum(val); val_norm=val/sum_va...

4 years ago | 2

Answered
Fit curve to a model problem
Personally, I would use fitnlm from the Statistics and Machine Learning Toolbox, but that is mainly due to familiarity, I suppos...

4 years ago | 0

| accepted

Answered
NaN (not a number) in numerical integration
Looks like your function becomes infinite. Here's a plot zooming in where it happens ep=0.2; u=0.2; lam=0.7; n=1000; f=@(al...

4 years ago | 0

Answered
Pythagorean triples - wrong output in loop
You need R(I+1, :) = [a+b+c, a, b, c]; rather than R(a, :) = [a+b+c, a, b, c]; For sorting, after your run your algorithm, r...

4 years ago | 0

| accepted

Answered
How to avoid the mistake plot if one x value corresponding to two or more y values?
If the density of your points is high enough, you could consider plotting only the markers, and not the connecting lines, e.g. ...

4 years ago | 0

Answered
Error in untitled (line 3)
The first argument to quad2d needs to be a function handle. I am not familiar with eprload, but its output looks like (x,y) dat...

4 years ago | 0

| accepted

Answered
select a character value to display depending on the value entered
I believe this will do what you want. Define the cell array lt_list = {'Constant','Constant on below' ... etc then lt1 = lt...

4 years ago | 0

| accepted

Answered
How can I fit histogram?
Answering the first part of your question ... With probability normalization, the sum of the bin heights will be 1. With pdf no...

4 years ago | 1

| accepted

Answered
I'm trying to create a function and it's not working, I don't know what's wrong with it?
You need x=-2.*pi:0.01:2.*pi; instead of using semicolons for defining the vector.

4 years ago | 0

Answered
function periodic in matlab
I think this does what you want: x = -3*pi : 0.01 : 3*pi; f = @(x) (mod(x+pi/2,pi) - pi/2).^2; figure plot(x,f(x))

4 years ago | 0

Answered
Highest row number in a table
% Example table n = 7; x = rand(n,1); y = rand(n,1); T = table(x,y); % Get number of rows MaxRows = size(T,1)

4 years ago | 0

| accepted

Answered
Interpretation of whisker in a boxplot for lognormal distribution
If I have done this correctly, it is about 92.2% ... % Calculation for normal distribution q3 = norminv(0.75,0,1); q1 = normi...

4 years ago | 0

| accepted

Answered
Looping through 4 Images that have fixed names
IMList="app.IM"+(1:4) creates a 1x4 string array, and then you can loop through that array to use the names.

4 years ago | 0

Answered
Table Find Duplicate Rows (double, char, datetime)
You might need to share some more details about your table, but you should be able to use the unique function. % Make some pret...

5 years ago | 1

Answered
Histogram of overlaid standard normal draws
If you look carefully, you will notice that your bins are not at precisely the same locations. If you instead choose the exact b...

5 years ago | 1

| accepted

Answered
How do I sum the elements in a vector up to a specific value?
Here is one way: v = [2,3,2,2,1,3,1,10,3]; prize = sum(v(1:find(v==10,1)-1))

5 years ago | 0

Answered
How to add iteration in a string (make multiple strings using iterations without indexing) ?
Here is one way: for i = 1:4 matlab = sprintf("png%d",i) end Here is another, but wanted to show the first way, which ca...

5 years ago | 1

| accepted

Answered
Append rows to a starting row
It would be much easier for us to help if you uploaded your data file your code (instead of an image of your code) However, i...

5 years ago | 0

| accepted

Answered
Obtaining a logic vector (?) from a logic array
A = [0 0 0 0; 1 0 0 0; 1 1 0 1; 0 0 0 0; 0 1 1 0]; v = any(A,2)

5 years ago | 0

| accepted

Answered
I want to generate a matrix of random numbers between 0 and 2.5 with length=8 and the sum of generated numbers be 20
Use the Random Numbers with Fixed Sum submission from the File Exchange.

5 years ago | 0

| accepted

Answered
Exclude certain dates on x-axis using xlim or xtick?
One possible solution to this would be to use a tiledlayout to plot each day in its own subplot.

5 years ago | 0

| accepted

Answered
How to combine multiple plots using subplot?
Prior subplots that would be overlapped by later plots are deleted. Try this simple on your local machine. figure subplot(3,1,...

5 years ago | 0

Answered
write p-value into plot
You can use the text or annotation functions. The text function is easier, but the annotation function is more powerful.

5 years ago | 0

| accepted

Answered
Non linear regression: Matlab function similar to Excel solver ???
This very old question/answer from the Mathworks Support Team indicates that there is no MATLAB function for the generalized red...

5 years ago | 0

Answered
Show free variables in solution(s) instead of zeros
A numeric matrix in MATLAB cannot hold an "x". You could change them to NaN: % Your solution M = [0, 0, 90.0, 0, 0, 0; ...

5 years ago | 0

Answered
Predictions Logistic Regression model using fitglm
I have a couple of comments, before answering your specific questions. First, you might benefit by reading up a little bit on g...

5 years ago | 1

| accepted

Answered
Turning a char element in a double array
a = char('[21,12,43,1]'); array_convert = str2num(a)

5 years ago | 0

Load more