Answered

how can i show up to 6 periods of this signal only, while being able to see the top and bottom of the wave?

Check out this section of the documentation: zoom xon This can also be done interactively but it is harder to explain. See thi...

how can i show up to 6 periods of this signal only, while being able to see the top and bottom of the wave?

Check out this section of the documentation: zoom xon This can also be done interactively but it is harder to explain. See thi...

1 month ago | 1

Answered

Is there a function similar to "where"?

Yes it is called logical indexing. The exact details depend on what type of data you have. A plain numeric matrix, a table, a ...

Is there a function similar to "where"?

Yes it is called logical indexing. The exact details depend on what type of data you have. A plain numeric matrix, a table, a ...

1 month ago | 1

Answered

Calculate the difference between minimum values of a parabola and straight line (from a plot)

Maybe this? W = 60000; S = 28.2; AR=7; cd0 = 0.02; k = 0.04; RC=0.51; clalpha = 2*pi; Psl=741000; hv=0:1:10; cdminp=4...

Calculate the difference between minimum values of a parabola and straight line (from a plot)

Maybe this? W = 60000; S = 28.2; AR=7; cd0 = 0.02; k = 0.04; RC=0.51; clalpha = 2*pi; Psl=741000; hv=0:1:10; cdminp=4...

1 month ago | 1

| accepted

Answered

How would I plot the function p(x)=e^(-0.5x)*(4-x)-2 in the range of -2 to 10 as well as its derivative?

You had the '.' characters in the wrong place; they go right before the '*' to get element-by-element multiplies. x = -2:0.1:1...

How would I plot the function p(x)=e^(-0.5x)*(4-x)-2 in the range of -2 to 10 as well as its derivative?

You had the '.' characters in the wrong place; they go right before the '*' to get element-by-element multiplies. x = -2:0.1:1...

1 month ago | 2

| accepted

Answered

How to make a line-plot? Time series

Maybe this is what you are looking for. This isn't very pretty using the small sample dataset but maybe it will look better wit...

How to make a line-plot? Time series

Maybe this is what you are looking for. This isn't very pretty using the small sample dataset but maybe it will look better wit...

1 month ago | 0

| accepted

Answered

I have simple divisions between integers and I always get another integer as the answer. But I want at least three decimal places. I am using MATLAB R2022b

How were B and C created? If they really are integers (e.g., class int32), then that is the expected result. The default type ...

I have simple divisions between integers and I always get another integer as the answer. But I want at least three decimal places. I am using MATLAB R2022b

How were B and C created? If they really are integers (e.g., class int32), then that is the expected result. The default type ...

1 month ago | 0

| accepted

Answered

Arguments accept char, string or "cellstr" (cell array of char or string)

Interesting issue. Looks like you have to create a "custom validation function". See if something like this works for you. a ...

Arguments accept char, string or "cellstr" (cell array of char or string)

Interesting issue. Looks like you have to create a "custom validation function". See if something like this works for you. a ...

1 month ago | 1

Answered

How ro fix the "Error using alpha Too many output arguments"?

Did you mean this line tic;[flow2,energylist2]=mexDiscreteFlow(sift1,sift2,[alpha,alpha*20,60,30]);toc to actually be this ins...

How ro fix the "Error using alpha Too many output arguments"?

Did you mean this line tic;[flow2,energylist2]=mexDiscreteFlow(sift1,sift2,[alpha,alpha*20,60,30]);toc to actually be this ins...

1 month ago | 0

| accepted

Answered

How to plot a variable increasing in a for loop

You should read this documentation page: Array Indexing Also, I would recommend taking the time to go through the online tutor...

How to plot a variable increasing in a for loop

You should read this documentation page: Array Indexing Also, I would recommend taking the time to go through the online tutor...

1 month ago | 0

Answered

Variable as placeholder in an "fopen" statement

The way I would do this is this subject = "PO1"; folder = "/Users/addison/Documents/Data/"; filename = "Results2" + subject +...

Variable as placeholder in an "fopen" statement

The way I would do this is this subject = "PO1"; folder = "/Users/addison/Documents/Data/"; filename = "Results2" + subject +...

1 month ago | 0

| accepted

Answered

Extract data points from a plot corresponding to the plot legend

fig = openfig('ExampleData.fig'); % open and get a handle to the figure % get(fig); ax = get(fig, 'CurrentAxes'); % get handle...

Extract data points from a plot corresponding to the plot legend

fig = openfig('ExampleData.fig'); % open and get a handle to the figure % get(fig); ax = get(fig, 'CurrentAxes'); % get handle...

1 month ago | 0

| accepted

Answered

How can I create for loop on contourf and save plots somewhere?

I'm not sure I believe this data since we are seeing probablities of > 1 in some cases (perhaps an interpolation/extrapolation a...

How can I create for loop on contourf and save plots somewhere?

I'm not sure I believe this data since we are seeing probablities of > 1 in some cases (perhaps an interpolation/extrapolation a...

1 month ago | 0

Answered

Loading data from .mat file and converting them to string array

You only save one variable into the mat file and its name is Grades. The syntax load('matfilename.mat', 'varname') tries to fin...

Loading data from .mat file and converting them to string array

You only save one variable into the mat file and its name is Grades. The syntax load('matfilename.mat', 'varname') tries to fin...

1 month ago | 0

| accepted

Answered

How to split the last 4 elements in a column into a new column?

I'm not sure why you want to do this, or what you intend to do with the results, but here is one possible way using a cell array...

How to split the last 4 elements in a column into a new column?

I'm not sure why you want to do this, or what you intend to do with the results, but here is one possible way using a cell array...

1 month ago | 0

Answered

How to use if/then to assign a year to a set of dates?

table_a = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1286455/Data1.xlsx') table_a.date = datetim...

How to use if/then to assign a year to a set of dates?

table_a = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1286455/Data1.xlsx') table_a.date = datetim...

2 months ago | 0

| accepted

Answered

How can I plot this date time graph?

load('Years.mat') whos Climatology t = Climatology.TimeSeries + hour(Climatology.HourSeries); scatter(t, Climatology.HeightS...

How can I plot this date time graph?

load('Years.mat') whos Climatology t = Climatology.TimeSeries + hour(Climatology.HourSeries); scatter(t, Climatology.HeightS...

2 months ago | 0

Answered

Plot path of a aicraft by plot3

t_start = 0; t_end = 100; delta_t = 1; t = t_start:delta_t:t_end; x = zeros(size(t)); y = zeros(size(t)); z = zeros(size(t...

Plot path of a aicraft by plot3

t_start = 0; t_end = 100; delta_t = 1; t = t_start:delta_t:t_end; x = zeros(size(t)); y = zeros(size(t)); z = zeros(size(t...

2 months ago | 0

| accepted

Answered

Get all row indices where values of to columns reach their maximum

A = [1 2 3; 1 4 3; 2 4 3; 1 4 2]; m = max(A(:,2:end), [], 1) Output = find(all(ismember(A(:,2:end), m), 2))

Get all row indices where values of to columns reach their maximum

A = [1 2 3; 1 4 3; 2 4 3; 1 4 2]; m = max(A(:,2:end), [], 1) Output = find(all(ismember(A(:,2:end), m), 2))

2 months ago | 1

| accepted

Answered

problem with if cycle to determine the datetime

The time returned by datetime('now') will be changing as your code runs, so it seems almost impossible that your if condition wi...

problem with if cycle to determine the datetime

The time returned by datetime('now') will be changing as your code runs, so it seems almost impossible that your if condition wi...

2 months ago | 0

| accepted

Answered

how to create matrix c, where first column is vector a, and the last column is vector b without a loop

a = [1;2;3;4;5]; c = [a a+1 a+2 a+3] If you are a beginner in using Matlab, I would suggest taking a couple of hours to go ...

how to create matrix c, where first column is vector a, and the last column is vector b without a loop

a = [1;2;3;4;5]; c = [a a+1 a+2 a+3] If you are a beginner in using Matlab, I would suggest taking a couple of hours to go ...

2 months ago | 0

Answered

How do i fix the output of my code?

a=rand(2,2) c=1; cmax=2; r=1; rmax=2; while r<=rmax while c<=cmax a(c,r)=round(a(c,r),2); % a(c,r)*100; << y...

How do i fix the output of my code?

a=rand(2,2) c=1; cmax=2; r=1; rmax=2; while r<=rmax while c<=cmax a(c,r)=round(a(c,r),2); % a(c,r)*100; << y...

2 months ago | 0

| accepted

Answered

Creating Plot with 2 Y-Axis

No there is no way to do that without some manual coding (if only on the command line). But it isn't hard. Here's a simple exam...

Creating Plot with 2 Y-Axis

No there is no way to do that without some manual coding (if only on the command line). But it isn't hard. Here's a simple exam...

2 months ago | 0

Answered

Force 0 tick to appear in a scatter plot

clc, clear, clf n = 0:10; f = n.^2; scatter(n,f, 'k', 'filled') xlim([-1,11]), ylim([-10,120]) ax = gca; ax.XAxisLocation =...

Force 0 tick to appear in a scatter plot

clc, clear, clf n = 0:10; f = n.^2; scatter(n,f, 'k', 'filled') xlim([-1,11]), ylim([-10,120]) ax = gca; ax.XAxisLocation =...

2 months ago | 1

| accepted

Answered

Logical operator not evaluating correctly

I would do this in separate steps. X = randi([-20, 20], [1 15]) Y = zeros(size(X)); Y(X < -5) = -1; Y(X > 5) = 1

Logical operator not evaluating correctly

I would do this in separate steps. X = randi([-20, 20], [1 15]) Y = zeros(size(X)); Y(X < -5) = -1; Y(X > 5) = 1

2 months ago | 0

Answered

Why are tick marks only on one axis when I change the tick spacing?

Try yticks(-4:0)

Why are tick marks only on one axis when I change the tick spacing?

Try yticks(-4:0)

2 months ago | 2

| accepted

Answered

Find exceeds array ERROR

One obvious problem with this code is where you try to access pairs(pr,2) but pairs is a one dimensional (4x1) vector. Perhaps ...

Find exceeds array ERROR

One obvious problem with this code is where you try to access pairs(pr,2) but pairs is a one dimensional (4x1) vector. Perhaps ...

2 months ago | 0

| accepted

Answered

one time pad plus randstream

Assuming that the random part of the algorithm is generating the code character vector as you said in one of your comments, some...

one time pad plus randstream

Assuming that the random part of the algorithm is generating the code character vector as you said in one of your comments, some...

2 months ago | 0

| accepted

Answered

how to get no of samples?

If you want a specific number of samples between two endpoints, use linspace instead of the colon operator: n = linspace(9.45, ...

how to get no of samples?

If you want a specific number of samples between two endpoints, use linspace instead of the colon operator: n = linspace(9.45, ...

2 months ago | 1

Answered

Trying to generate subplot figure

It looks like you have created a variable named figure. Type the following command at your command prompt: which -all figure ...

Trying to generate subplot figure

It looks like you have created a variable named figure. Type the following command at your command prompt: which -all figure ...

2 months ago | 0

| accepted