Answered
How to Rescale X Axis in Plot
Maybe this example will show you how you can do that. First, I'll create a random matrix the same size as yours: y = rand(1470...

4 years ago | 0

Answered
Simulation of a suspension in Matlab
u is based on t: t = [0:0.01:1]; u = 60*sin(3*t) but when you call lsim, you use u with a different time vector: lsim(GSA, u...

4 years ago | 0

| accepted

Answered
Equation in a loop that feeds an answer matrix
It seems like you should be setting an element of results instead of s each time through the loop: %With a loop n=7; %station ...

4 years ago | 0

| accepted

Answered
How to increase font size and remove extra space in prompt window/listdlg ?
To get rid of the extra space inside the listbox, you can specify its size (in pixels): list = {'1','2','3'}; [indx]=listdlg( ...

4 years ago | 0

| accepted

Answered
I would like to change how the color of the circles change in my code.
You might try using this function from the File Exchange: https://www.mathworks.com/matlabcentral/fileexchange/29702-generate-m...

4 years ago | 0

Answered
Why did I receive these error messages? Unrecognized field name "angle1". angle1=180-handles.angle1; gui_mainfcn(gui_State, varargin{:}); feval(varargin{:});
The code in pushbutton1_CreateFcn belongs in pushbutton1_CallbackFcn, most likely. If you upload both the .m and the .fig file ...

4 years ago | 0

Answered
Plot two looping variables
In order to see how aoa and CLin change in each iteration of the while loop, you can either: (1) plot them each time through the...

4 years ago | 0

| accepted

Answered
How to add a noise in my stairs signal?
I'm not really sure what you're going for, but maybe something like this (using randn to generate random numbers from a Normal d...

4 years ago | 0

Answered
How to randomly select coordinates from given set of data?
xy = [1 2; 3 4; 5 6; 7 8; 9 0]; n_pts_to_select = 3; selected_pts = xy(randi(size(xy,1),n_pts_to_select,1),:)

4 years ago | 1

| accepted

Answered
Loop a whole code to display each variation of a variable
Since aoa is in radians, rather than incrementing it by 1 radian each time, perhaps you mean to increment it by pi/180 radians, ...

4 years ago | 0

| accepted

Answered
How to cut the signal from a specific point?
First, I create some random signals, to approximate the situation: green_signal = 0.4*rand(1,265); blue_signal = rand(1,210); ...

4 years ago | 1

| accepted

Answered
How to make two different size matrix of same size
Don't use length to do that. length is the size of the longest dimension, so without knowing whether that's dimension 1 (number ...

4 years ago | 1

| accepted

Answered
Problem with conditions in If statement
Typically you'd ask the user for input and check that the input is valid inside a while loop, because you need to keep asking un...

4 years ago | 0

| accepted

Answered
how can I change the color of the bar 2,4,6?
load('sl.mat'); T=categorical(T); % turn into categorical variable You can set the colors when you create the bar: ...

4 years ago | 0

| accepted

Answered
Input Dates from an excel sheet without getting a NaN
M(:,0) would refer to the 0th column of M, but indexing in MATLAB starts at 1. There is no 0th column, so that's why you get tha...

4 years ago | 1

Answered
Need to initialize variables from a txt file
T = readtable('fueldata.txt','VariableNames',{'put' 'your' 'variable' 'names' 'here'});

4 years ago | 1

| accepted

Answered
need to find local maxima and minima of each row of a 7886 * 321 matrix stored in xlsx file.
extrema is a 7886-by-321 matrix of zeros, so this expression: extrema(Diff1(i,:)) says to get the elements of extrema at the i...

4 years ago | 1

| accepted

Answered
Creating a new graph for each row in a matrix
One fairly easy way to separate the floorplans is to plot each one into its own axes (using tiledLayout or subplot, for instance...

4 years ago | 0

| accepted

Answered
Code involving factorials and a given value
@Ryan Johnson Using a while loop to solve this problem is a perfectly good approach. The main thing you need to change is the wh...

4 years ago | 0

| accepted

Answered
Index exceeds the number of array elements. Index must not exceed 11.
For the given inputs, n is 11, and mt is initialized to be a 1-by-11 vector: % h=.5,t=0,y=3,p=5 n=((p-t)/h)+1; % n = 11 for th...

4 years ago | 0

Answered
My code will not plot the rectangle, it says theres an issue I cant figure out where I am going wrong?
I guess that "office": rectangle('Position',[locationx locationy ... sFloor(c).resident(i).width ... sFloor(c).office...

4 years ago | 1

| accepted

Answered
Issue printing and saving some data in a file ID from excel in Guide
I don't see the part of the code where the timer is created (actually the part where the timer's TimerFcn is specified, which ma...

4 years ago | 0

| accepted

Answered
Help convert into a code
I think your expression for u is ok (but note that 68.2128*10^-6 can be written more compactly as 68.2128e-6, etc., which allows...

4 years ago | 1

| accepted

Answered
Length/Index based if else statements
idx = find(x < b,1); if isempty(idx) idx = numel(b); end m = K(idx); The above assumes b is sorted in ascending order, ...

4 years ago | 0

| accepted

Answered
colorbar tick labels -string above and below, remove ticks
f = figure(); set(gca(),'Visible','on'); n_colors = 64; h = axes( ... 'Parent',f, ... 'Units','normalized', ... ...

4 years ago | 0

Answered
Using verticalRegion, but no graph appears
Try it like this: f = @(x)x.^2; g = @(x)x; % calling verticalRegion verticalRegion(f, g, 0, 1) % defining verticalRegion f...

4 years ago | 0

| accepted

Answered
How to Plot Multiple Plots with Multiple Subplots in Multiple Figures?
'"figure(1)", "figure(2)" ... gives me an index out of range error' That error happens when indexing a variable, which means th...

4 years ago | 0

Answered
How do I plot an equation?
One way: x = -0.02:0.0001:0.02; y = exp(-x/0.005); plot(x,y) Another way: y = @(x)exp(-x/0.005); fplot(y,[-0.02 0.02])

4 years ago | 0

Answered
Find the average of each row, ignore the first column
Let me make up a matrix C C = (1:4)+[1;2;3;4]*10 By default, mean operates along the first dimension, so this A = C(:,2:end);...

4 years ago | 0

| accepted

Answered
How to check if a number is repeated some times in a row?
sim=randi(2,1,10) Here's one way, using strfind: count = numel(strfind(sim,ones(1,5))) Here's another way, using a loop (you ...

4 years ago | 0

Load more