Answered
An unexpected discrepancy between xcorr, xcov and autocorr
When in doubt always read the documentation. doc xcov Matlab functions are very good documented. For example, you can read: x...

1 year ago | 0

Answered
Why I couldn't plot this graph f=(@(x,y) (x.^2)+(x*y)+(y.^2)<=68200.^2/3);
And if you really insist on 68200^2/3, then this code will provide output f=@(x,y) x.^2+x.*y+y.^2-68200^2/3; fimplicit(f, 'b'...

1 year ago | 0

Answered
Can I make this line of code smaller?
XBest=[2, 3, 4]; XBest(isempty(XBest)) = 1e8; XBest XAest = []; XAest(isempty(XAest)) = 1e8; XAest

1 year ago | 1

| accepted

Answered
Why the 2nd code does not behave like the 1st code?
This is how I would modified the code to execute for any M r N dimensions: clear clc u = [10 20 30 40]; b = u * (1+0.5*randn...

1 year ago | 1

| accepted

Answered
Unable to perform assignment because brace indexing is not supported for variables of this type
You need to provide more context. For example, this is OK. run = cell(10,1); R = 244:300; Y = 1:300; run{1} = Y(1:R(1)) ru...

1 year ago | 0

Answered
How to get subset of data from given thresholds?
Did you try this approach? DNS = dat(:,9); NZE = dat(:,10); PER = dat(:,11); % 1. sub = dat(NZE>0.25,:); %2. sub = da...

1 year ago | 0

| accepted

Answered
How to read a specially structured data file with different structures
I would suggest the follwoing solution: A = readtable('test.5p', 'ReadVariableNames', false, 'FileType', 'text'); nr_rows = si...

1 year ago | 1

| accepted

Answered
Why the 2nd code does not behave like the 1st code?
It is because in the function "myfunAskMathworks.m" you have function handles defined. So, you are sending the function handle a...

1 year ago | 1

Answered
How to read a specially structured data file
I would also like to suggest my naive and inefficient approach: A = dlmread('testfile5p.txt'); nr_rows = size(A,1); A2 = zero...

1 year ago | 1

Answered
how to plot a mean line in a plot
Perhaps, you can use this code: plot(t1,x.*t1);

1 year ago | 1

Answered
Hi! How I can extract specific data
Hello Aknur, This example code will perform task you specified. % code which will take exactly data where the last three % ...

1 year ago | 0

| accepted

Answered
Solving a system of equations with dependent variables symbolically
syms a b c d x z y s sol = solve([y==a*b-c,z==d*a+b,x==c*a+b,s==c*b-a],[a,b,c,d],'Real',true) sol.a, sol.b,sol.c, sol.d

1 year ago | 0

| accepted

Answered
I would like to count the number of peaks of a signal.
t = 0:0.01:2; y = sin(20*t); [z, ind] = findpeaks(y); plot(t,y) hold on plot(t(ind), z, 'o') number_cylces = numel(diff(...

1 year ago | 1

Answered
reorder data in a matrix
It seems to me that you want this logic implemented: A = ["10010" ; "11000" ; "11010" ; "01100" ; "01011"] N = numel(A); B =...

1 year ago | 0

Answered
How to know the data set after augment?
This is an extract from the documentation: % transform Create a new datastore that applies a function to the % data rea...

1 year ago | 0

Answered
Intersection of two tables
Maybe this code can help you: A = table(); A.user = {'user1';'user2';'user3';'user4'}; A.value = [10;20;30;40] B = table()...

1 year ago | 0

Answered
Problems using Linear Regression and syntax
Can you clarify what exactly is the problem with Matlab syntax? Here is what is obtained if your code is executed: clear clc ...

1 year ago | 0

Answered
What is the answer of [(4 -2 ) /2 , 5 +6 , 7 , 8 ] ? Why does MATLAB output [1 5 6 7 8]?
In Matalb, when you define an array (or vector) you can use the following syntax: v = [1 3 4 5 6] This is exactly the same as:...

1 year ago | 0

Answered
Error using Solve with symmatrix equation
The function solve doesn'tsupport symmatrix. One way to solve matrix equeation is the follwoing: A_r = [3 -6; 5 2]; B_r = [7 4...

1 year ago | 0

| accepted

Answered
Creating a matrix based on sorted values from another matrix
[As, ind] = sort(A); C = [As;B(ind)]

1 year ago | 0

| accepted

Answered
How to have two legends on the same plot?
Perhaps you meant this: t = 0:0.1:5; y = sin(t); z = cos(t); figure; hold on; for i = 1:2 p1(i) = plot(t, y,'r'); ...

1 year ago | 2

Answered
why do i get the error using alpha too many output arguments, can anyoen help please.
You didn't define variable alpha. Because of that, Matlab thinks you want to use built in functionality: help alpha alpha - Ge...

1 year ago | 0

Answered
How to remove noise (unwanted data)
I would suggest the following approach: % read file into table %T = readtable('KLOG0024.csv'); outfile = websave('KLOG0024.cs...

1 year ago | 1

Answered
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and function body must be sym expression.
If you want to define equations eq1, eq2 and eq3, you need to use function handles: syms v2 v3 I2 v1 = 20; del_t = 0.5; R = ...

1 year ago | 1

| accepted

Answered
Help implementing code (Newton-Raphson)
@Allan I would like to suggest somewhat simpler code: maxIter = 200; maxTol = 1e-14; V0 = linspace(0, 10, maxIter); % para...

1 year ago | 0

| accepted

Answered
Index error: must be logical or positive integer.
T=10:2:60; f=-1:length(T)+1; total=-1; i=f+total; et=3.5e-4; dn1=1e-9:100e-9; size(dn1) size(i) if i==0 r=0; else ...

1 year ago | 0

| accepted

Answered
Array indices must be positive integers or logical values.
It seems to me that you actually want this: [t,y]=ode45(@problem03ODEFunction,[0 20],[2 0 0]); plot(t,y(:,1)) hold on; gri...

2 years ago | 1

Answered
HPF doesn't work in time-domain convolution
Please have a look at this code. This is to confirm that multiplication in freq. domain and convolution in time domain will prov...

2 years ago | 0

Answered
how do i write a matlab script to sum this expression
Matlab has a built in function called rmse, so there is no need to write a Matlab script, unless this is a homework. In that cas...

2 years ago | 0

Answered
Compare of symbolic expression for trigonometric
Perhaps, this is the way to go with sym expressions: isAlways(A == B) isAlways(cond) checks if the condition cond is valid ...

2 years ago | 0

| accepted

Load more