Respondida
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...

más de 4 años hace | 0

Respondida
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...

más de 4 años hace | 0

| aceptada

Respondida
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 ...

más de 4 años hace | 0

| aceptada

Respondida
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( ...

más de 4 años hace | 0

| aceptada

Respondida
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...

más de 4 años hace | 0

Respondida
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 ...

más de 4 años hace | 0

Respondida
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...

más de 4 años hace | 0

| aceptada

Respondida
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...

más de 4 años hace | 0

Respondida
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),:)

más de 4 años hace | 1

| aceptada

Respondida
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, ...

más de 4 años hace | 0

| aceptada

Respondida
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); ...

más de 4 años hace | 1

| aceptada

Respondida
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 ...

más de 4 años hace | 1

| aceptada

Respondida
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...

más de 4 años hace | 0

| aceptada

Respondida
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: ...

más de 4 años hace | 0

| aceptada

Respondida
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...

más de 4 años hace | 1

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

más de 4 años hace | 1

| aceptada

Respondida
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...

más de 4 años hace | 1

| aceptada

Respondida
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...

más de 4 años hace | 0

| aceptada

Respondida
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...

más de 4 años hace | 0

| aceptada

Respondida
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...

más de 4 años hace | 0

Respondida
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...

más de 4 años hace | 1

| aceptada

Respondida
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...

más de 4 años hace | 0

| aceptada

Respondida
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...

más de 4 años hace | 1

| aceptada

Respondida
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, ...

más de 4 años hace | 0

| aceptada

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

más de 4 años hace | 0

Respondida
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...

más de 4 años hace | 0

| aceptada

Respondida
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...

más de 4 años hace | 0

Respondida
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])

más de 4 años hace | 0

Respondida
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);...

más de 4 años hace | 0

| aceptada

Respondida
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 ...

más de 4 años hace | 0

Cargar más