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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2 months ago | 0

| accepted

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

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

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

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

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

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

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

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

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

Why are tick marks only on one axis when I change the tick spacing?
Try yticks(-4:0)

2 months ago | 2

| accepted

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

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

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

Next value in alphabet
A simpler approach: char('c' + 1)

2 months ago | 1

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