Community Profile

photo

Les Beckham


Last seen: Today Active since 2013

Many years developing flight control algorithms and software

Programming Languages:
C

Statistics

All
  • MATLAB Central Treasure Hunt Finisher
  • Knowledgeable Level 4
  • First Review
  • 6 Month Streak
  • Thankful Level 1
  • First Answer
  • Solver

View badges

Content Feed

View by

Answered
how do I swap both axes in the current plot
syms y U = y^2/2 - (3*y)/4; yrange = [0,1]; fp = fplot(U,yrange); plot(fp.YData,fp.XData) grid on

3 days ago | 1

| accepted

Answered
Code to determine a log of the mean for a column of numbers?
A = magic(4) logmean_col1 = log(mean(A(:,1))) max_col2 = max(A(:,2)) mean_col3 = mean(A(:,3)) mean_col4 = mean(A(:,4))

3 days ago | 1

Answered
Find unique number sets
A = [1 4; 2 3; 3 2; 1 4]; B = unique(sort(A, 2), 'rows')

4 days ago | 0

Answered
Why is Q=30 after the loop is ran?
B=1; Q=0; if B==1 && Q~=B Q=20; if B<0 || Q==20 % you just set Q equal to 20 on the line above so this condition is ...

4 days ago | 0

| accepted

Answered
How to plot the bode plot extracted from LTspice in Matlab?
I used the import tool to import the data as fixed width data (right click on the file in the Current Folder and select Import D...

4 days ago | 0

| accepted

Answered
If there is a coding "sqrt(sum(data(:,1:end).^2,2))" , so what is the function number 2 after comma?
That tells the sum() function to sum along the rows. See the documentation for sum here

4 days ago | 1

| accepted

Answered
Extracting data from a matlab figure and saving it as a .mat file
open('6000_1.fig') hl = findobj(gca, 'Type', 'line'); % find the lines x = get(hl, 'Xdata'); % extract the data y = get(hl, '...

5 days ago | 1

| accepted

Answered
Filling gaps in a vector using a secondary data set
rain1 = [nan nan 1:10 nan nan] % example data rain2 = [20:34] idx = isnan(rain1); % find where rain1 has nans rain1(idx) = ra...

5 days ago | 0

| accepted

Answered
Guessing the values of a function by using initial values
You don't have to "guess" the values of the function, you can just calculate them. Example x = [-20:.1:20]; y = x; [X,Y] = m...

5 days ago | 0

Answered
Replacing Values in Matrix that are not equal to 1 while excluding 'NaN'
test1 = [ NaN 2 9 2 -.23 NaN 3 2 -1 -1 NaN 6 -.4 -1 -.57 NaN] test2 ...

6 days ago | 0

Answered
Concatenating Edit Field value with an existing string in App Designer
First, if you are getting an error, that is usually what will help you (and us) figure out what is wrong so, please, post the co...

6 days ago | 0

Answered
How to tick the parameter in the plot of a parametric function?
Try this (or something similar): % Your original code t = linspace(0, 1, 1000); x = t.^2; y = t.^3; figure plot(x, y, '-'...

10 days ago | 1

Answered
Two easy questions (But I am confused)
Using smaller examples so we can see the results: S = magic(10) % sample matrix d = diag(S) % extract the diagonal elements %...

11 days ago | 0

Answered
How to plot a 3-D "hotspot" figure
I would suggest looking at this example for the scatter3 function: scatter3 with varying marker colors You could use your f(x, ...

12 days ago | 1

| accepted

Answered
How do I demagnify a help page?
Ctrl-Scroll Down will reduce the magnification

13 days ago | 0

| accepted

Answered
How can I programmatically open the results of a command in a new window without setting it to a variable?
I can only think of a way to do this in two steps rather than one. result = 2 + 2; openvar('result'); This should work in des...

14 days ago | 1

Answered
Efficient Way to find index of max column for each row
Are you wanting to find the column number of the maximum value in each row? If so, this is how you can do that: A = magic(5) %...

27 days ago | 0

Answered
Too many output arguments (five on output)
You are defining this function as a function that takes 5 input arguments and returns one output argument. function y_cubic=cub...

28 days ago | 0

Answered
Strange result in subtraction operation
The "obvious" result is 1.2e-14 not 1.12e-14 (the different last two digits in your original numbers at the 14 decimal place giv...

28 days ago | 0

Answered
Removing quotation marks in a string using for loop
The quotation marks are not actually part of the string. It is just displayed that way. Plus, since you are using strings inst...

1 month ago | 0

| accepted

Answered
What is this center line when I create m file from mlx file?
I believe that what you are seeing (if you are viewing these in the Matlab editor) is the "Right-hand text limit" line. You can...

1 month ago | 0

| accepted

Answered
How to Extract 2048 values containing the maximum value?
Note that this plots the group that contains the maximum datapoint in all of the data. It does not "plot the largest 2048 value...

1 month ago | 1

| accepted

Answered
How to find the zero vaue of a plot?
X=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]; Y=[-0.88 -0.7489 -0.6178 -0.4867 -0.3556 -0.2245 -0.0934 0.0378 0.168...

1 month ago | 1

| accepted

Answered
Display time before the prompt arrows
See this utility on the File Exchange: https://www.mathworks.com/matlabcentral/fileexchange/26471-setprompt-set-the-command-win...

1 month ago | 1

| accepted

Answered
How to do the example below in MatLab? I am dealing with same sort of problem in matlab
Something like this should do what you want (using made up example data): % simulating read of csv file1 (replace by data1 = re...

2 months ago | 1

| accepted

Answered
Where is the error in my code?
You need to specify an increment size if you expect r to be a vector. Currently it is a scalar equal to zero. Q will not be a ...

2 months ago | 0

Answered
help on graph (w/o common matrix plotting built-in functions)
In that case, maybe something like this will get you close. A = randi(2,10,365)-1; x = 1:size(A,2); y = size(A,1):-1:1; for ...

3 months ago | 0

| accepted

Answered
help on graph (w/o common matrix plotting built-in functions)
A = randi(2,10,365)-1 str = repmat(' ', size(A)); str(A==1) = '-'; disp(str)

3 months ago | 1

Answered
Reveresing the order of columns in an array
% Note: use semicolons instead of commas for row breaks so you get 4 columns q = [1 2 3 4; 5 6 7 8; 9 10 11 12; 13 14 15 16; 17...

3 months ago | 0

Answered
Recognise specific pattern in timetable
One approach without requiring the Signal Processing Toolbox: load('answers.mat') % an approximation of your data x = data(:,1...

3 months ago | 1

Load more