Answered
Vectorising nested for loops
% unzip and load data unzip data.zip load data.mat % run the loop method, for later comparison k=0; struct_data = struct(...

18 days ago | 1

| accepted

Answered
Graphing specific function over time
t = linspace(0,10,100); da = 0.5+0.425*sin(2*pi*60*t); plot(t,da)

18 days ago | 1

| accepted

Answered
How to write a circuit value whit complex numbers
I = 220*cos(50*t+30)/52.4;

18 days ago | 0

Answered
I need my code to loop while my input is binary (ones and zeros). once the user inputs any other value then the loop should stop.
while true bin = input('Input binary number: ','s'); if ~all(bin == '0' | bin == '1') break end D =...

18 days ago | 0

| accepted

Answered
what am I doing wrong here? It keeps saying my value for d is incorrect
d=(-cosd(60)/6)+(exp(3.*y)+(x.*y./(z.^3)).*((z./2).^(-3/4))).^3 % ^ ^ you ...

18 days ago | 0

| accepted

Answered
Plot with different shapes
A = 2*rand(10,1); B = 20*rand(10,1); C = 30*rand(10,1); grid on box on hold on x = 1:10; y = A; yyaxis left plot(x,y,'p...

18 days ago | 1

| accepted

Answered
How do I extract from array with values I got from that same array?
% call peaks() to get the indices of the peak(s), based on the 2nd column of ICA: peak_indices = peaks(ICA(:,2)); % get the ...

18 days ago | 0

Answered
Edit matrix with condition
idx = mm(:,7) <= 0.0115 & mm(:,7) > 0.01; p_n = mm(idx,1:2); v_n = mm(idx,3:4); p_b = mm(~idx,1:2); v_b = mm(~idx,3:4);

19 days ago | 1

| accepted

Answered
Select X, Y coordinates randomly but only do each pair 5 times
X_vector = [3; -3; -9; -15; -21; -15; -9; -3; 3; 3; -3; -9; -15; -21; -21; -15; -9; -3; 3; 3; -3; -9; -15; -21; -15; -9; ...

19 days ago | 0

Answered
Error using evalin Undefined function or variable 'var'.
This line evalin('base',"Port=var;"); evaluates "Port=var;" in the base workspace. Apparently you don't have a variable called...

19 days ago | 1

Answered
plot based on a value
% random vectors (10x1) of values between 0 and 2 AA = 2*rand(10,1); BB = 2*rand(10,1); CC = 2*rand(10,1); DD = 2*rand(10,1)...

19 days ago | 1

| accepted

Answered
I need to combine those three martix into a single big one. How do I do that?
See blkdiag: https://www.mathworks.com/help/matlab/ref/blkdiag.html

19 days ago | 0

| accepted

Answered
How to sum values from a cycle
After the loop: ang_sum = sum(ang);

19 days ago | 0

Answered
Trying to plot 20 points on top of an image for a curve. After solution in class was posted, when running it I get "Conversion to double from cell is not possible." Why?
Change the function mybezier to return a double rather than a cell array, i.e., remove the {} filename = "peppers.png" [y,z] =...

19 days ago | 0

| accepted

Answered
How to set default axes tick using groot?
set(groot,'DefaultAxesXMinorTick','on','DefaultAxesYMinorTick','on')

19 days ago | 0

Answered
for loop over video data
Does this work as expected? [n_frames,n_rows,n_columns,n_color_channels] = size(data); block_size = 30; n_frames_to_process =...

19 days ago | 0

| accepted

Answered
I'm getting an error using fplot, How do I get it to work?
Xs = 1.8; fs = 10; fi = pi/3; t1 = -0.1; t2 = 0.2; t = [t1, t2]; x = @(t)Xs*sin(2*pi*fs*t+fi); fplot(x,t,'-')

19 days ago | 1

| accepted

Answered
How to display an image and a plot on the same figure while controlling axes
my_image = uint8(linspace(1,0,720)'*linspace(1,0,1280)*255); % some diagonal color gradient angles = linspace(0,4*pi,200); m...

19 days ago | 1

| accepted

Answered
Variable might be set by non scalar operator
m=('insert value'); should be m=input('insert value');

19 days ago | 0

Answered
Manipulate strings in a table- remove leading numbers if present
load S solution = regexprep(names,'^[\d\.]+\s+','')

19 days ago | 0

| accepted

Answered
Patch - controlling transition of transparency - how to?
To have all patches span the full transparency range, use normalized values, where each column of fit is normalized separately. ...

20 days ago | 0

| accepted

Answered
Why does the line plot depend on the generator type in a for loop ?
The i_subset passed in to make_line_plot.m is a column vector, and that is assigned to generator if mode == 1. Then generator is...

20 days ago | 1

| accepted

Answered
How can I set zero value to white? in mesh plot
Like Rik said, one option is to replace zeros with NaNs in A; then they won't show up at all (so by default you see the white ax...

20 days ago | 0

| accepted

Answered
How to list all situation of vector including fix number?
perms(1:10) https://www.mathworks.com/help/matlab/ref/perms.html

20 days ago | 0

| accepted

Answered
Find match between 2 tables of unequal length
new_table = B(ismember(B.Name,A.Name),:);

20 days ago | 0

| accepted

Answered
How can I add this condition on my code?
U = [10;20;30;40;5;60;40;80;20;100]; V = [2;3;4;5;6;7;8;9;10;1]; idx = find(diff([0;floor(cumsum(U/100))])) V(idx) sum(V(i...

20 days ago | 0

| accepted

Answered
Mask with a for loop
removeData([2 3 0 0 7 8 0]) function vec = removeData(vec) x = 1; while x < numel(vec) if vec(x) ~= 0 && vec(x + 1) ==...

20 days ago | 0

Answered
Unique concatenation of multi-dimensional cell arrays
A(:,:,1) = {[1;2;3],[],[3]; [],[],[4]; [],[2;3],[]}; A(:,:,2) = {[2;3;4],[4],[3]; [],[],[4]; [],[2;4],[]}; ...

20 days ago | 1

Answered
Monitoring a directory for new files does not catch all the files
new_files will contain the names of all the new files, so instead of using just new_files(end) and assuming there's one new file...

20 days ago | 0

| accepted

Answered
3D axes ticks get truncated when figure window is not maximized
Set the xticks manually (like you set the xlim manually): xticks(928:933) Maybe the yticks too: yticks(200:100:600)

20 days ago | 0

Load more