已回答
Shading between two plot lines, then removing the outline
x = 0:0.01:4*pi; % create some fake data to plot y1 = sin(x); y2 = y1 + 0.2*x; figure % hold all % plot(x,y1,'color',[0.8...

2 years 前 | 0

| 已接受

已回答
How do I align decimal points in a table?
I think I found a solution. Use the Figure Space s = compose('%10.4f', 50*rand(5,1)); snew = cellfun(@(c) strrep(c, ' ', char...

2 years 前 | 1

已回答
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...

2 years 前 | 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 ...

2 years 前 | 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...

2 years 前 | 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...

2 years 前 | 2

| 已接受

已回答
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...

2 years 前 | 0

| 已接受

已回答
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 ...

2 years 前 | 0

| 已接受

已回答
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 ...

2 years 前 | 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...

2 years 前 | 0

| 已接受

已回答
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...

2 years 前 | 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 +...

2 years 前 | 0

| 已接受

已回答
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...

2 years 前 | 0

| 已接受

已回答
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...

2 years 前 | 0

已回答
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...

2 years 前 | 0

| 已接受

已回答
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...

2 years 前 | 0

已回答
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 years 前 | 0

| 已接受

已回答
How can I plot this date time graph?
load('Years.mat') whos Climatology t = Climatology.TimeSeries + hour(Climatology.HourSeries); scatter(t, Climatology.HeightS...

2 years 前 | 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 years 前 | 0

| 已接受

已回答
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 years 前 | 1

| 已接受

已回答
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 years 前 | 0

| 已接受

已回答
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 years 前 | 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 years 前 | 0

| 已接受

已回答
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 years 前 | 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 years 前 | 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 years 前 | 0

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

2 years 前 | 2

| 已接受

已回答
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 years 前 | 0

| 已接受

已回答
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 years 前 | 0

| 已接受

已回答
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 years 前 | 1

加载更多