How to plot graph with multiple values of x in a function
You need to use elementwise operations: count=0; for i=[3,5,7,10,20,100] count=count+1; x=linspace(-5,2,i); sub...

17 jours ago | 1

| accepted

Matlab R2021a will not open after upgrade to MacOS Monterey
It looks from this chart of system requirements that R2021b is the only version to be compatible with Monterey.

19 jours ago | 0

Natsort Rows using in program.
You need to ... go to the submission's page here click the Download button on the right-hand side of the page unzip the zip f...

19 jours ago | 0

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)

21 jours ago | 0

| accepted

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

22 jours ago | 1

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...

25 jours ago | 2

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...

25 jours ago | 0

| accepted

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...

25 jours ago | 0

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...

25 jours ago | 0

| accepted

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. ...

25 jours ago | 0

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...

26 jours ago | 0

| accepted

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...

27 jours ago | 0

| accepted

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...

30 jours ago | 1

| accepted

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.

environ un mois ago | 0

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))

environ un mois ago | 0

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)

environ un mois ago | 0

| accepted

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...

environ un mois ago | 0

| accepted

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.

environ un mois ago | 0

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...

environ un mois ago | 0

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...

environ un mois ago | 1

| accepted

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))

environ un mois ago | 0

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...

environ un mois ago | 1

| accepted

Append rows to a starting row

environ un mois ago | 0

| accepted

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)

environ un mois ago | 0

| accepted

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.

environ un mois ago | 0

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.

environ un mois ago | 0

| accepted

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,...

environ un mois ago | 0

How to tell matlab to, instead of throwing an error message, give me a Boolean (e.g., 0 means I get error) when I try to use Horner command
You could use a try-catch routine to catch the error.

environ un mois ago | 0

| accepted