A résolu


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

plus de 4 ans il y a

A résolu


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

plus de 4 ans il y a

Réponse apportée
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))

plus de 4 ans il y a | 0

A résolu


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

plus de 4 ans il y a

A résolu


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

plus de 4 ans il y a

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

plus de 4 ans il y a | 1

A résolu


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

plus de 4 ans il y a

Réponse apportée
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); ...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 4 ans il y a | 0

Réponse apportée
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...

plus de 4 ans il y a | 0

A résolu


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

plus de 4 ans il y a

A résolu


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

plus de 4 ans il y a

A résolu


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

plus de 4 ans il y a

A résolu


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

plus de 4 ans il y a

Réponse apportée
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...

plus de 4 ans il y a | 0

Réponse apportée
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,:)=[]

plus de 4 ans il y a | 1

| A accepté

Réponse apportée
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)';...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
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(:,...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
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

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
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=...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 4 ans il y a | 0

Réponse apportée
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...

plus de 4 ans il y a | 1

Réponse apportée
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'}; ...

plus de 4 ans il y a | 0

Réponse apportée
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...

plus de 4 ans il y a | 0

Réponse apportée
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...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
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

plus de 4 ans il y a | 0

| A accepté

A résolu


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]; ...

plus de 4 ans il y a

A résolu


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]

plus de 4 ans il y a

Réponse apportée
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...

plus de 4 ans il y a | 0

| A accepté

Réponse apportée
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];...

plus de 4 ans il y a | 0

| A accepté

Charger plus