Answered
How to obtain data in a matrix from fig.file?
The ‘Children’ propertiy disappeared with the introduction of ‘HG2’ (handle graphics version 2) in R2014b. You most likely ne...

8 years ago | 0

| accepted

Answered
Area Under the Graph
I am not certain what you want. I would instead use the cumtrapz function for the entire data set, then find the frequencies ...

8 years ago | 0

Answered
Upsampling an audio signal in matlab
I am not certain what you want to do. One option is to use the resample (link) function. Another option is the modulate (l...

8 years ago | 0

Answered
How to Calculate linear trend for each column of a matrix
Try this: [D,S] = xlsread('test.xlsx'); B = [(1:size(D,1))', ones(size(D,1),1)] \ D producing: B = -0.7307 -0.6702 ...

8 years ago | 1

| accepted

Answered
How can I preallocate a matrix for this loop to make my code more efficient?
Try this: [r,c] = ind2sub(size(M), M(tril(M)>0)); Out = [M(tril(M)>0), c, r] producing: Out = 1 1 1 6 ...

8 years ago | 1

| accepted

Answered
How can I plot Pu based on p in this equation??
As you have defined it, ‘P’ will not work because it has more than 16 elements. First, define ‘A’, noting that in MATLAB indi...

8 years ago | 0

| accepted

Answered
Solving An Equation - Linear Algebra
Straightforward: KFF = Kff \ -(Kfs*us) KFF = 5.5556 -21.8750 Another option is to use fsolve: [UF, fval] = fs...

8 years ago | 0

| accepted

Answered
How do I do a linear fit on half of the data points in a set?
There are several problems with the code you posted. This works for me: fig3 = figure; for ij = 1:N subplot(1,N,ij); ...

8 years ago | 0

| accepted

Answered
I am using pole-zero map (pzmap) and i want to enhance the size of pole or zero (or in other words i want to change the marker size). Please guide me how can i do by coding?
It is not obvious, and requires some experience with ‘handle diving’ into graphics objects. Try this: H = tf([2 5 1],[1 3 5...

8 years ago | 1

| accepted

Answered
Find time when position less than zero
I cannot run your code. You can get the index of the first position that is negative using the find function: negpos - find...

8 years ago | 0

Answered
Polyfit is not showing the expected fit
You forgot to include ‘mu’ in your polyval argument list. If you ask for it in polyfit, you need to include it in polyval: [y...

8 years ago | 5

| accepted

Answered
Why std function returns NaN?
Please explain ‘certain chunks of the data’. When I load ‘R’, there are no NaN values, and: Rstd = std(R) Rstd = ...

8 years ago | 0

Answered
Local functions. Appending results of looping to previous variable; creating separate variable for each loop.
Subscript the outputs. If they are scalars, use: for i=1:10 [icke(i,:),data(i,:)]=localfunction(x) end If they are vec...

8 years ago | 0

Answered
Can't set axis to the correct lim/max and space between values
You probably need to use the semilogy plot: x = [0 60]; y = exp(-x*0.5); figure semilogy(x, y) ylim([1E-12,1]);

8 years ago | 0

Answered
How to smoothen the curve for yaxis in logx axis?
Try interpolation: y = [0.92,0.9,0.75,0.47,0.32]; x = [10e-02,10e-1, 10e0, 10e1, 10e2]; xi = logspace(log10(min(x)), log10...

8 years ago | 0

| accepted

Answered
Is possible solve a integral with a vector in the limitis?
Yes. Try this: fun = @(x,xdata) x(1) + x(2).*arrayfun(@(xd)integral( @(V) V , 0 , xd),xdata); It works either with or with...

8 years ago | 1

| accepted

Answered
How to store a series of scalars from a loop of solver in a vector? Save outputs from solver in a vector
You appear to be doing the estimation of one parameter, ‘x’, not a vector of them, for all your data. This code: load('coef...

8 years ago | 1

| accepted

Answered
how to use the Bode matlab function to plot only the magnitude of a transfer function
If you only want the magnitude, call bode as: [mag,phase,wout] = bode(sys); then plot ‘mag’ as a funciton of ‘wout’: figure...

8 years ago | 0

Answered
Integration using multiple formula's and a single variable.
You are actually integrating with respect to ‘t’. Express all your functions as function of ‘t’, and it should work. However...

8 years ago | 0

| accepted

Answered
Why different p-values for ranksum and kruskalwallis on two groups
They are different tests, with different hypotheses. The ranksum test compares medians between two groups, assuming both share ...

8 years ago | 0

| accepted

Answered
How come I can't plot this?
The hold on call should be just after the first plot call, and diff produces a vector (here) that is one element shorter than it...

8 years ago | 0

Answered
Create a legend for complex numbers plot
Your ‘poles_sys_a’ matrix is confusing the plot function. If you create the ‘poles_sys_a’ matrix to vectors (using the ‘(:)’ no...

8 years ago | 1

| accepted

Answered
Pole Zero Map using two vectors
This is a system identification problem. Use the System Identification Toolbox. Start with the iddata (link) function, then tf...

8 years ago | 0

| accepted

Answered
how to check the 'contribution' of each predictor in a linear regression
You are describing a stepwise multiple linear regression. Seee the documentation on the stepwiselm (link) function and its frie...

8 years ago | 0

| accepted

Answered
Hi, I need some advice/help with cell accessing and operation in a for loop.
The error is likely because of the first result being empty. Try this: for n=1:100 % I have use findpeaks here to get ...

8 years ago | 0

| accepted

Answered
Get lsqcurvefit to approximate an amplitude frequency response
The ‘amplitude’ objective function should be doing element-wise division, and is not. Also, ‘Q’ should not be transposed. Tr...

8 years ago | 0

| accepted

Answered
How to determine the transfer function from experimental data?
Not enough information. However this will get you started: freq = [0.1 0.2 0.4 0.6 0.8 1 2 3 4 5 6 7 8 9 10]; gainDB = [-7.5...

8 years ago | 0

Answered
Solving equations involving log
Using built-in MATLAB functions (no Toolboxes required): U = 4.2; N = 1.1; r = 3.1; fcn = @(x) ((r.^x - 1)./(r.^N -1)) - U;...

8 years ago | 0

Answered
Fast implementation of calculating peaks/local maxima of magnitude of transfer function
Using the Signal Processing Toolbox function is significantly faster: b = [0.2461, -0.0829, -0.0673, 0.0829, -0.1788]...

8 years ago | 0

Answered
How do you get a symbolic answer for this z transform in MATLAB
If I remember correctly, the z-transform of theDirac delta funciton is 1, so: syms x n x(n) z x(n) = 2*dirac(n-2) + 3*heavis...

8 years ago | 0

| accepted

Load more