# Walter Roberson

I do not do free private consulting. If you want to bring my attention to something, send a link to the MATLAB Answers location. I am currently caught up to T0099000; if you are waiting on a reply from me for an older issue, please send me a reminder.

**Programming Languages:**

C++, C, MATLAB, Shell, Perl, Fortran

**Spoken Languages:**

English

**Statistics**

RANK**1**

of 242,869

REPUTATION**115,572**

CONTRIBUTIONS

**34** Questions

**52,381** Answers

ANSWER ACCEPTANCE **
52.94%
**

VOTES RECEIVED**14,828**

RANK

of 16,985

REPUTATION**N/A**

AVERAGE RATING**0.00**

CONTRIBUTIONS**0** Files

DOWNLOADS **0**

ALL TIME DOWNLOADS**0**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**0** Highlights

AVERAGE NO. OF LIKES

**Content Feed**

Converting values to units

values = randi([0 800], 1, 10) b = [-800 300 800]; mask = values < b(2); scaled(mask) = (values(mask)-b(1))./(b(2)-b(1)); sc...

4 hours ago | 0

how to calculate theta

Xo = 1234; V = 20000; syms theta t = .1:.1:1; eqn = 3010 == Xo + (V .* cosd(theta)) .* t thetas = double(arrayfun(@(E) vp...

8 hours ago | 0

Convert units to g

%need some data for demonstration t = seconds(0:0.5:10); y = randn(1, length(t)); %now do the work y_g = y ./ 9.80665; pl...

8 hours ago | 1

| accepted

add multiple lines to a single plot without using "hold on/off"

%% Create Plots % Would like pressure dist overlaid on airfoil shape tiledlayout(2,1); ax1 = nexttile; plot(ax1,x,y); hold(...

9 hours ago | 0

| accepted

Huge number of iterations

fcn = @() fopen( sprintf( 'chem_%d.txt', labindex ), 'wt' ); w = WorkerObjWrapper( fcn, {}, @fclose ); % a and b are cell arra...

10 hours ago | 0

How to loop over a function call?

y = [y1, y2, y3, y4] fun = @(x) reshape(sum(arrayfun(@(Y) Least_square(x(:), Y), reshape(y, 1, [])),2), size(x))

11 hours ago | 0

Can not shift image relative to plot with Imtranslate

and shown with imshow(image) I do not recommend imshow() for this purpose: it does too many things to the axes that are not des...

15 hours ago | 1

Initializing all rows with one set of values in one half and another set in the other half

cA(:,:) = repmat([cA0*ones(1,(N-1)/2+1),Kw/cB0*ones(1,(N+1)/2-1)], size(cA,1), 1); Or consider nrow = size(cA,1); cA(:,:) = [...

15 hours ago | 0

| accepted

Saving data array in Matlab data file (.mat) in App Designer

save('YourFileName.mat', 'NameOfVariable', 'AnotherVariable') Note that if the values you want to save are currently stored wit...

15 hours ago | 0

How to get same xlsread "raw" output whithout using xlsread?

mask = cellfun(@isdatetime, YourCell); YourCell(mask) = cellfun(@(DT) datetime(DT, 'format', 'dd/MM/yyyy'), 'uniform', 0); Now...

15 hours ago | 0

how to join the values of different cells in different columns in one cell ?

T.Date = datetime(T.Year, T.Month, T.Day, T.Hour, T.Min, 0, 'Format', 'uuuuMMddhhmm'); Note: I did not use the format you asked...

15 hours ago | 1

| accepted

Issue with numerical integration of two variable function

A = @(x, y) cos(x)+sin(y) B = @(x, y) A(x,y)-integral(@(X)A(X,y), 0 , 2*pi, 'ArrayValued', true) fsurf(B, [-pi pi -pi pi])

15 hours ago | 0

How to Solve matrix equations in Matlab

Optimal solutions, in the sense of smallest least-squared. Are there other solutions? Yes: you can ask to solve eqn2 with retur...

16 hours ago | 1

Finding 8 points on an ellipse

Refering to https://math.stackexchange.com/questions/493104/evaluating-int-ab-frac12-r2-mathrm-d-theta-to-find-the-area-of-an-el...

16 hours ago | 1

| accepted

Trying DIC 2D by ncorr

I notice that you are using a fairly old version of MATLAB. Still, uibuttongroup() should have been defined in your MATLAB. T...

18 hours ago | 0

Error in plotting an equation given y data sets (y vs x)

Your code wants to calculate the formula for each y value, for all possible x values. But to do that, you have to make the symbo...

18 hours ago | 0

| accepted

filtfilt fails with B=1, A=1 on matrix

It appears to be a bug. In context: filtfilt() calls filter() to do some of the work. When a and b are scalars, filter is goi...

19 hours ago | 0

Clear symbolic from an equation and make it mathematical function

syms x f=(17*exp((281*x)/50000))/1000 + (4777*x*exp((281*x)/50000))/50000000 ff = matlabFunction(f); x=4.5:1:40.5; plot(x,...

22 hours ago | 0

| accepted

how to find a float number

[is_there, idx] = ismembertol(-0.3340, y7) %options allow you to control tolerances y7(idx) Also, [~, idx] = min(abs(y7(:) -...

22 hours ago | 1

Solve a system of linear ODEs, and plot them

You built R as a column vector but your vector of constants 10^-7 and so on is a row vector. You will accidentally creating conf...

1 day ago | 1

Could someone please tell me why this code is printing(Dam level too low) for almost every output.

Newvol(k+1)=Newvol(k)+(Qin(k)-Qout); Newvol is a vector. if Newvol>=p100; You are testing the entire vector in that statemen...

1 day ago | 0

How to Plot a function that contains summation?

alpha = 8; m = (1:alpha).'; f = @(x) 2/pi + sum(2 .* ((-1).^m - 1)./(pi .* m.^2) .* cos( m.*x ), 1); fplot(f, [-pi pi])

1 day ago | 1

| accepted

graph won't plot in correct spot

If you do not want negative values shown, then clip them out of the plot by adjusting xlim and ylim. % plot mountain Mn_x = [0...

1 day ago | 0

how to assign imagesc to figure 1

fig1 = figure(1); ax1 = axes('Parent', fig1); imagesc(A1, 'Parent', ax1); If there is an existing axes you want to draw int...

1 day ago | 0

| accepted

Support for other Raspberry Pi operating systems.

Are there any plans to support other - non Raspberry Pi fundation based - operating systems / distros? No. There are too many L...

1 day ago | 0

I am finding it difficult to write extended langmuir isotherm using summation.

The meaning of that is not clear. The expression contains both and using exactly the same symbol . That tells us that the non...

1 day ago | 0

Please someone help me correct my code. I want to plot a 2D graph for distinct alpha in one single 2D plot. See the attached photo for the guidience

alpha=[0.7, 0.8,0.9,1]; P=1; t=0.5; s = (-5:0.2:5).'; A=(1-s.^2)+((P-4).*(t.^alpha))./(gamma(alpha+1)); plot(s,A); xlabel(...

1 day ago | 0

| accepted

Curve fitting with integral involved

format long g T = [120,210,400,540,650]; B = [-344,-157,-17.5,-0.85,10.5]; syms t y syms constant [1 2] expr = ((2.*pi.*(...

1 day ago | 0

| accepted

How I can modify this code to read files in a folder into tables?

nfiles = length(theFiles); results = cell(nfiles,2); fullnames = fullfile({theFiles.folder}, {theFiles.name}); results(:,1) =...

2 days ago | 1

| accepted

Displaying a set of images from a folder

projectdir = 'path/to/image/directory'; ext = '.png'; %adjust according to kind of images dinfo = dir( fullfile( projectdir, ...

2 days ago | 0

| accepted