Solved


MATLAB Basic: rounding II
Do rounding nearest integer. Example: -8.8, answer -9 +8.1 answer 8 +8.50 answer 9

4 years ago

Solved


MATLAB Basic: rounding
Do rounding near to zero Example: -8.8, answer -8 +8.1 answer 8

4 years ago

Answered
how to make an anonymous function with more than 1 statement or equation?
B=2; C=4; f=@(x) B*x +C*x^2; % d=@(x) C*x^2 sqrt(f(2))

4 years ago | 0

Solved


Make a random, non-repeating vector.
This is a basic MATLAB operation. It is for instructional purposes. --- If you want to get a random permutation of integer...

4 years ago

Solved


Create times-tables
At one time or another, we all had to memorize boring times tables. 5 times 5 is 25. 5 times 6 is 30. 12 times 12 is way more th...

4 years ago

Answered
Stacked bar graph with repeating datetime
A=readtable('Project1.xlsx', 'PreserveVariableNames', 0); AA=table2array(A); B = regexp(table2array(A), '\s+', 'split'); % sp...

4 years ago | 1

Solved


Swap the first and last columns
Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becomes the first. All oth...

4 years ago

Answered
Why is my plot shaking but not plotting the noise?
x = 0:pi/200:(2*pi);% does't need e = rand; % does't need y = x.*sin(x)+(0.5*e); % does't need x_star = 0:(pi/200):(2*pi); ...

4 years ago | 0

| accepted

Answered
An integer multiple a function
I dont know the value of n. I took it 200. A=load('ecg_hw2.mat'); ecg=A.ecg ; N = [2 4 8 16 32]; b = 1./N; ye = cell(size(b...

4 years ago | 0

Answered
how do i plot the output with constant input
Vonew=45; vin=30; y=Vonew; %i get my Voutnew=45 plot( vin,y, 'o', 'LineWidth', 2); xlabel('vin', 'FontSize', 20); ylabel('v...

4 years ago | 0

Solved


Swap the input arguments
Write a two-input, two-output function that swaps its two input arguments. For example: [q,r] = swap(5,10) returns q = ...

4 years ago

Solved


Triangle Numbers
Triangle numbers are the sums of successive integers. So 6 is a triangle number because 6 = 1 + 2 + 3 which can be displa...

4 years ago

Solved


Generate a vector like 1,2,2,3,3,3,4,4,4,4
Generate a vector like 1,2,2,3,3,3,4,4,4,4 So if n = 3, then return [1 2 2 3 3 3] And if n = 5, then return [1 2 2...

4 years ago

Solved


Make the vector [1 2 3 4 5 6 7 8 9 10]
In MATLAB, you create a vector by enclosing the elements in square brackets like so: x = [1 2 3 4] Commas are optional, s...

4 years ago

Answered
Adding date to timetable with just time
follow this https://www.mathworks.com/matlabcentral/answers/288524-how-do-you-separate-the-contents-of-one-cell-into-separate-c...

4 years ago | 0

Answered
How to add a first row and a first column of zeros in a matrix?
A=[1 2 3; 4 5 6; 7 8 9]; AA=[zeros(1,3);A]; AAA=zeros(4,1); B=[AAA AA]; B(:,end)=[]; B(end,:)=[]

4 years ago | 1

| accepted

Answered
How to extract monthly data in a matrix
As you did not attach any data, i took the random data A=readtable('Data.xlsx'); Data=table2array(A(:,2)); Year=(1971:2000)';...

4 years ago | 0

| accepted

Answered
Subtracting elements within a table
A=[1 23 2 24 3 21 4 34 1 89 2 23.2 3 34.8 4 -23.1]; My_Table= table(A(:,...

4 years ago | 0

| accepted

Answered
non zero elements in an array
a=[1 2 4 5 3 0 0 8 0]; [idx]=find(a<2); a(idx)=0; out=a; [idx2]=find(out>=2); out(idx2)=1

4 years ago | 0

| accepted

Answered
Getting a compound matrix to work
n=[1,3,16]; P=800; t=20; format shortG y=P.*(1+t/100).^n-P; % Compound Interest,C.I.= P × (1+t)n - P Year_1=y(1); Year_3=...

4 years ago | 0

| accepted

Answered
Compare two vector arrays and if they match set vector array 2 = nan?
Try this... time = [0,0,0,0,2,3,4,5,5,6,7,8]; solution = [1,2,0,0,1,1,2,2,2,0,0,0]; [idx]=find(time==solution); solution(id...

4 years ago | 0

Answered
Difference between two time values in minutes
t1 = {'08/24/2010 13:21:47.030'}; t2 = {'08/24/2010 14:13:09.118'}; dt= diff(datenum([t1;t2]))*24*60 % to get the second sec...

4 years ago | 1

Answered
Adding text to plot with random inputs
y=20*randn(1,100000)+80; histogram(y,11) title('Normal Distribution') xlabel('Value'); ylabel('Count'); txt1={'\mu = 80'}; ...

4 years ago | 0

Answered
how to add timestep iteration and show all iteration in plot
time = [4 50] ; points = [20 100] ; % interpolation step_count = time(1):0.1:time(2) ; % timestep 0.1 expected_points = inte...

4 years ago | 0

Answered
Loop through array containing coordinates points
Try this... p0 = [1, 1]; p1 = [2, 3]; p2 = [4, 3]; p3 = [3, 1]; cords = [p0, p1, p2, p3]; N=length(cords); for i = 1:leng...

4 years ago | 0

| accepted

Answered
how to make "two matrixes → one matrix repeated colum"
please have a look here https://www.mathworks.com/matlabcentral/answers/266969-combine-two-matrices-every-other-column

4 years ago | 0

| accepted

Solved


Column Removal
Remove the nth column from input matrix A and return the resulting matrix in output B. So if A = [1 2 3; 4 5 6]; ...

4 years ago

Solved


Reverse the vector
Reverse the vector elements. Example: Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]

4 years ago

Answered
Matlab filter columns of array based on value in row
use 'find' function to look up the value which is equal to 3 in 'z' x=randi(100,3,3000); y=randi(80,3,3000); z=randi(50,3,30...

4 years ago | 0

| accepted

Answered
color in output in matlab
It might be helpful https://www.mathworks.com/matlabcentral/answers/15328-adding-color-in-command-window-output a=[1 2 3 4 4];...

4 years ago | 0

| accepted

Load more