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

4 days ago | 1

| accepted

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

4 days ago | 0

| accepted

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

4 days ago | 0

Answered
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))

4 days ago | 0

| accepted

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

4 days ago | 1

| accepted

Answered
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(:,:) = [...

4 days ago | 0

| accepted

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

4 days ago | 1

| accepted

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

4 days ago | 0

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

4 days ago | 1

| accepted

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

4 days ago | 0

| accepted

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

4 days ago | 1

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

4 days ago | 1

| accepted

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

4 days ago | 0

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

4 days ago | 0

| accepted

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

4 days ago | 0

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

5 days ago | 0

| accepted

Answered
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(:) -...

5 days ago | 1

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

5 days ago | 1

| accepted

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

5 days ago | 0

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

5 days ago | 1

| accepted

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

5 days ago | 0

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

5 days ago | 0

| accepted

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

5 days ago | 0

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

5 days ago | 0

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

5 days ago | 0

| accepted

Answered
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.*(...

5 days ago | 0

| accepted

Answered
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) =...

5 days ago | 1

| accepted

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

6 days ago | 0

| accepted

Answered
Index in position 1 exceeds array bounds (must not exceed 1). Error in pij (line 14) pmat(k,n) = pis(k,1) .* tau(k,n); Error in pfij (line 18)
Consolidated code, as you are having difficulty understanding me: I do not recommend running this with maximum function evaluat...

6 days ago | 0

| accepted

Answered
What should go in a next-generation MATLAB X?
This would not break backwards compatibility, but something to consider: A lot of time, people try to for x = first:increment...

6 days ago | 1

Load more