Answered

Plotting graph using roots

The roots you have calculated are the x values where y = 0. Therefore to plot these on a graph you can use: p = [1 5.5 3.5 -10]...

Plotting graph using roots

The roots you have calculated are the x values where y = 0. Therefore to plot these on a graph you can use: p = [1 5.5 3.5 -10]...

1 day ago | 1

| accepted

Answered

Array indices must be positive integers or logical values.

I just ran this segment of code and I get the same "Array indices must be positive integers or logical values." error but for th...

Array indices must be positive integers or logical values.

I just ran this segment of code and I get the same "Array indices must be positive integers or logical values." error but for th...

4 days ago | 0

| accepted

Answered

BAR graph not working

Is that the exact piece of code you used? On my computer (and Matlab version R2018a) that runs absolutely fine.

BAR graph not working

Is that the exact piece of code you used? On my computer (and Matlab version R2018a) that runs absolutely fine.

4 days ago | 0

Answered

iterate through elements of matrix

Chuguang Pan answer is correct but is in the comments section rather than the answers section. This won't be able to be accepted...

iterate through elements of matrix

Chuguang Pan answer is correct but is in the comments section rather than the answers section. This won't be able to be accepted...

4 days ago | 0

Answered

Trying to change colours on the the same plot, but getting error message 'There is no b property on the Line class'

The issue with your plotting command is that matlab is interpreting the 'b',1 part as a pair of commands (i.e. ste the property ...

Trying to change colours on the the same plot, but getting error message 'There is no b property on the Line class'

The issue with your plotting command is that matlab is interpreting the 'b',1 part as a pair of commands (i.e. ste the property ...

4 days ago | 0

| accepted

Answered

Elementwise Matrix multiplication with a Vector to get a higher dimension Matrix

I think this should do the trick. A1 = [1 2 3; 4 5 6; 7 8 9]; Asize = size(A1); V1 = (1:1:3); lengthV1 = length(V1); A2 = z...

Elementwise Matrix multiplication with a Vector to get a higher dimension Matrix

I think this should do the trick. A1 = [1 2 3; 4 5 6; 7 8 9]; Asize = size(A1); V1 = (1:1:3); lengthV1 = length(V1); A2 = z...

5 days ago | 1

| accepted

Answered

200 pixel to mm

There will definitely be a correlation between number of pixels and size/area, however I don't think you can use it for quantita...

200 pixel to mm

There will definitely be a correlation between number of pixels and size/area, however I don't think you can use it for quantita...

5 days ago | 0

Answered

Finding a trendline from a scatter plot

MATLAB can do this if you make your scatter plot and then in the figure window go to "Tools -> Basic Fitting". That will then al...

Finding a trendline from a scatter plot

MATLAB can do this if you make your scatter plot and then in the figure window go to "Tools -> Basic Fitting". That will then al...

6 days ago | 1

| accepted

Answered

Problems using parfor due to way variable is used

I think the answer to the below question might be of use to you here. https://uk.mathworks.com/matlabcentral/answers/404809-how...

Problems using parfor due to way variable is used

I think the answer to the below question might be of use to you here. https://uk.mathworks.com/matlabcentral/answers/404809-how...

6 days ago | 0

Question

Adjust z-axis location for a pcolor() plot

I am attempting to vertically stack a number of pcolor plots within the same set of axes and then overlay some contour lines ont...

6 days ago | 0 answers | 0

Answered

add to a vector by plus 1 and plus 2

I think this should do what you are after X = [1;2;3]; for i=1:3 X(i) = X(i)+i; end Another way would be to do: X = [1;2;3...

add to a vector by plus 1 and plus 2

I think this should do what you are after X = [1;2;3]; for i=1:3 X(i) = X(i)+i; end Another way would be to do: X = [1;2;3...

6 days ago | 0

Answered

load .mat files into a loop

You could store the filenames for your arrays into an array (possibly cell array might be better if they aren't all the same num...

load .mat files into a loop

You could store the filenames for your arrays into an array (possibly cell array might be better if they aren't all the same num...

9 days ago | 1

| accepted

Answered

How to plot a matrix with reoccurring values?

Take for example a matrix: vals = [1 1;2 1;2 2; 1 2; 1 3; 2 3; 2 4; 1 4]; which is of the form you describe above. Then do: p...

How to plot a matrix with reoccurring values?

Take for example a matrix: vals = [1 1;2 1;2 2; 1 2; 1 3; 2 3; 2 4; 1 4]; which is of the form you describe above. Then do: p...

9 days ago | 1

| accepted

Answered

Problem finding the index?

The problem is the precision which which your machine is able to store numbers. You are asking MATLAb to find an exact match to ...

Problem finding the index?

The problem is the precision which which your machine is able to store numbers. You are asking MATLAb to find an exact match to ...

9 days ago | 0

| accepted

Answered

Finding index (x value) of noisy data crossing a threshold value

idx = find(SmoothedData > Threshold); Width = Xdata(max(idx)) - Xdata(min(idx)); Here the first line finds all indices of poin...

Finding index (x value) of noisy data crossing a threshold value

idx = find(SmoothedData > Threshold); Width = Xdata(max(idx)) - Xdata(min(idx)); Here the first line finds all indices of poin...

11 days ago | 0

Answered

How to change Marker Color in line graph?

Can you try the below and let us know what happens please? I don't have the necessary toolboxes to check it myself. load('MCA_D...

How to change Marker Color in line graph?

Can you try the below and let us know what happens please? I don't have the necessary toolboxes to check it myself. load('MCA_D...

13 days ago | 0

| accepted

Answered

How Change Matrix Shape / Setting

Not necessarily a pretty solution but the below will do what you want for the given table. Should give you enough of an idea of ...

How Change Matrix Shape / Setting

Not necessarily a pretty solution but the below will do what you want for the given table. Should give you enough of an idea of ...

13 days ago | 1

| accepted

Answered

How to rewrite the maximum element of an array by an avarage

So, if I have interpreted your question correctly then you have an array (say A) and you wish to find the maximum valued element...

How to rewrite the maximum element of an array by an avarage

So, if I have interpreted your question correctly then you have an array (say A) and you wish to find the maximum valued element...

13 days ago | 0

| accepted

Answered

Concatenate 8X4 matrix in 16X2 matrix in matlab

This should do it: B = [A(:,1:2); A(:,3:4)]

Concatenate 8X4 matrix in 16X2 matrix in matlab

This should do it: B = [A(:,1:2); A(:,3:4)]

13 days ago | 1

| accepted

Answered

HELP NEEDED_ODE45MATLAB

Your problem here is that you haven't passed your parameters into the function. The line: function dY=ODEfun(t,Y,a,b,c,E,h1,N,D...

HELP NEEDED_ODE45MATLAB

Your problem here is that you haven't passed your parameters into the function. The line: function dY=ODEfun(t,Y,a,b,c,E,h1,N,D...

13 days ago | 0

Answered

Why don't you draw the line of vectors on the graph?

I think this is because you are plotting inside your while loop. Here you are telling it to plot one data point each time and so...

Why don't you draw the line of vectors on the graph?

I think this is because you are plotting inside your while loop. Here you are telling it to plot one data point each time and so...

13 days ago | 0

| accepted

Answered

How can I use one matrix to assign values to a second matrix using a for loop?

Based on your definition there is nothing to diffuse. If the values is the same all along your domain then there won't be any ch...

How can I use one matrix to assign values to a second matrix using a for loop?

Based on your definition there is nothing to diffuse. If the values is the same all along your domain then there won't be any ch...

16 days ago | 1

| accepted

Answered

Find zeros of numeric function

You could use fzero for this. Only issue is that it returns the zero closest to a chosen start point, therefore I've put a loop ...

Find zeros of numeric function

You could use fzero for this. Only issue is that it returns the zero closest to a chosen start point, therefore I've put a loop ...

16 days ago | 0

| accepted

Answered

Plotting a matrix in a for loop.

You have a couple of options here. One is that you store all of the steps of the Markov chain during the for loop and then plot ...

Plotting a matrix in a for loop.

You have a couple of options here. One is that you store all of the steps of the Markov chain during the for loop and then plot ...

18 days ago | 0

| accepted

Answered

change scale for colorbar

Have you tried looking at the below link - seems like that might do what you want https://uk.mathworks.com/matlabcentral/answer...

change scale for colorbar

Have you tried looking at the below link - seems like that might do what you want https://uk.mathworks.com/matlabcentral/answer...

18 days ago | 0

Answered

problem in maximizing figure window in matlab 2016a

If you are using R2018a or after then you can use f = figure; f.WindowState = 'maximized'; to maximise the figure window. To ...

problem in maximizing figure window in matlab 2016a

If you are using R2018a or after then you can use f = figure; f.WindowState = 'maximized'; to maximise the figure window. To ...

18 days ago | 0

Answered

White lines in 2D figure when exporting it

There isn't an accepted answer, but the following question has a lot of potential pointers that might be of use. https://uk.mat...

White lines in 2D figure when exporting it

There isn't an accepted answer, but the following question has a lot of potential pointers that might be of use. https://uk.mat...

18 days ago | 0

| accepted

Solved

Get the area codes from a list of phone numbers

Given a string of text with phone numbers in it, return a unique'd cell array of strings that are the area codes. s = '508-6...

20 days ago

Solved

Connect Four Win Checker

<http://en.wikipedia.org/wiki/Connect_Four Connect Four> is a game where you try to get four pieces in a row. For this problem, ...

20 days ago

Solved

Test for balanced parentheses

Given the input inStr, give the boolean output out indicating whether all the parentheses are balanced. Examples: * If ...

20 days ago