Answered
error Unbalanced or unexpected parenthesis or bracket
You may want to change the c1 line as follows. It is grammatically correct, but not necessarily correct for your problem. You ...

4 years ago | 0

Answered
Fill array between values
The rule is not clear in your question. In first/second row, you fill 3 between first 1 and last 2. In third row, you fille 3 b...

4 years ago | 0

| accepted

Answered
How can I use ODE45 continuously?
Just change D depending on t. Run the solver over the whole time period. [Update: See @Walter Roberson remarks below. The re...

4 years ago | 1

| accepted

Answered
MATLAB stft vs spectrogram
stft focuses on the FT of windowed and segmented (overlaped) data and the output can be used to reconstruct the original (under ...

4 years ago | 0

Answered
How to add slides with images and tables in company standard template ?
If you have access to MATLAB report generator: https://www.mathworks.com/help/rptgen/ug/update-presentation-content-programmati...

4 years ago | 0

Answered
How can I change the width of a tile in a tiledlayout without changing its height?
By changing figure size, you can achive that effect. figure('Position', [1, 1, 600, 400]) t = tiledlayout(1,3,'TileSpacing','C...

4 years ago | 0

| accepted

Answered
How to handle large variables in workspace
Only process the latest data and throw away old data. You need to consider streaming processing of your data. See suggestions ...

4 years ago | 0

| accepted

Answered
Select particular elements from a cell array to form a matrix (double type)
x = zeros(size(results)); for i=1:size(results, 1) for j=1:size(results, 2) x(i,j) = results{i,j}.endo_simul(17, ...

4 years ago | 0

| accepted

Answered
normalize the vector by taking the difference from the first element
T = [1; 2; 3]; T1 = T -T(1)

4 years ago | 0

| accepted

Answered
How can I make points show through a surface plot?
% Plot a sphere and a line [x, y, z] = sphere; h = surf(x, y, z); hold on plot3(-1:1, zeros(3,1), zeros(3,1), 'r', 'LineWid...

4 years ago | 0

| accepted

Answered
What is the most correct way of determining whether variable contains a number
It seems that you have to write your own function: [t, f] = isstranum(5) [t, f] = isstranum('nan') [t, f] = isstranum('-512.3...

4 years ago | 0

Answered
Graph data series with colors
load data.txt scatter(data(:,1), data(:,2), [], data(:,3), 'filled'); colorbar;

4 years ago | 0

Answered
Cell array formatting /restructuring
Here is a portion of code for you to further expand: % load data d = load('Data.mat'); n = size(d.Data, 1); % Find the FRA...

4 years ago | 0

| accepted

Answered
Compare elements of an array with all elements in a matrix
P = randn(5,4) C = randn(1,4) lv = C > P

4 years ago | 1

Answered
Reading and Processing Many Text Files
foldername = 'C:***FILE LOCATION***'; % True folder name needed fileprefix = 'RESULTS_ONE_'; for i=1:N ...

4 years ago | 0

| accepted

Answered
I created a code which does filtering with convulution but it gives an error
The image has 3 channels and is a 3D array. You need to loop over the 3rd dimension as well. Use a different image below. A =...

4 years ago | 0

| accepted

Answered
how to make a row all zeros in a matrix based on the two random number generated???
You can arrange A..F into a 3D matrix. X = randn(6,3, 6); idx = randperm(6, 2) for i=1:length(idx) X(idx(i), :, idx(i)) = ...

4 years ago | 0

| accepted

Answered
what is difference between C=+A, C=A, C=unary(A)? All three provide same assignment of matrix A to C
C=+A; C = uplus(A) is an alternate way to execute +A, but is rarely umeased. It enables operator overloading for classes. So ...

4 years ago | 0

| accepted

Answered
How can I Implement Runge Kutta 4 to plot the trajectory of a given point in a vector field?
As you have the intial point (0,0) and the intial speed (0,0), so the solution never progress to a different point. If you chan...

4 years ago | 0

| accepted

Answered
How can I Implement Runge Kutta 4 to plot the trajectory of a given point in a vector field?
tspan = 0:.1:10; x0 = [0; 0]; [t,x] = ode23(@odefun,tspan,x0); subplot(211); plot(t, x); xlabel('t'); legend('x', 'y') subpl...

4 years ago | 0

Answered
How can I Implement Runge Kutta 4 to plot the trajectory of a given point in a vector field?
Matlab has ode23 and ode45. https://blogs.mathworks.com/cleve/2014/05/26/ordinary-differential-equation-solvers-ode23-and-ode45...

4 years ago | 0

Answered
Add String to Matlab Plot Annotation
pfSize = 2; dim = [.2 .5 .3 .3]; str = ['Pf Size:' num2str(pfSize)]; % use [] instead of () plot(rand(10,1)) annotation('te...

4 years ago | 0

| accepted

Answered
How can I fill a map drawn with plotm with red color?
plotm is for lines. you can use patchesm for area. load coastlines axesm sinusoid; framem patchesm(coastlat, coastlon, 'r')...

4 years ago | 1

| accepted

Answered
How do I have a loop for different data intervals.
A=rand(50,10); idx = [1 10; 11 22; 23 40]; for i=1:size(idx,1) Anow = A(idx(i,1):idx(i,2), :); T = Anow'*Anow; end ...

4 years ago | 0

| accepted

Answered
Sudden error "Unidentified function or variable"
[X1 Y1] = Elispe(1, sqrt(4/3), 0, 0, 0, 2*pi); % Z1 = zeros(1, length(X)); Z1 = zeros(1, length(X1)); %Z2 = ones(1, length(...

4 years ago | 0

Answered
How do you do freestyle drawing in MATLAB?
This gives you a schetch. You can fill up the rest using "text" and "plot" commands. x = 5:30; y = .2*(x-12).^2 -30; plot(x,...

4 years ago | 1

| accepted

Answered
gaussian noise in infinite samples in real time matlab
t = 0; sigma = 1; % noise rms value while true x = cos(2*pi*0.01*t); % received data x = x + sigma * ra...

4 years ago | 0

| accepted

Answered
How to create subplot with .png images in a loop
Try montage in image processing toolbox for display multiple images. a = imread('onion.png'); imageArray = repmat(a, [1 1 1 3*...

4 years ago | 0

| accepted

Answered
How to adjust the legend of pie chart
Adjust the parameters if necessary. The plot in this web livescript is for illustration only. subplot(232); pie([51 2 45 2]);...

4 years ago | 0

| accepted

Answered
How to make line plot of 3 different colors?
% data x = [2:26 26:-1:-5]; y = [20:-1:-4 -5:-1:-36]; idx1 = y>=0; idx2 = y>=-10 & y<=0; idx3 = y<=-10; plot(x(idx1),...

4 years ago | 0

| accepted

Load more