Answered
Plotting a line given its slope and one coordinate
Try this: x = 88; y = 56; slope = 1.08; y_intercept = y - slope*x; xv = [0 100]; figure plot(xv, slope*xv+y_intercep...

7 years ago | 0

Answered
Need help displaying an output file for data.
I have no idea what you want to do. However if you create a table of your results, writetable could do what you want.

7 years ago | 1

| accepted

Answered
Repeat 3-D array elements
Use the repmat function: A = rand(67, 960, 80); B = repmat(A, 1, 1, 3); sizeB = size(B) producing: sizeB = 67 960 ...

7 years ago | 0

| accepted

Answered
AREA UNDER the CURVE
Defining your matrix as ‘M’, use the trapz function twice, once in each dimension: AUC = trapz(trapz(M)) producing: AUC = ...

7 years ago | 0

| accepted

Answered
Fitting data in x,y to a known function
Use the fminsearch function to fit your data: x1 = linspace(1,32,32); y1 = [0.01 0.02 0.02 0.02 0.02 0.02 0.03 0.03 0.03 0.04...

7 years ago | 1

| accepted

Answered
How can my function work?
Either change the function output to ‘Wans’: function Wans = fishing_load_factor(t) or change the ‘Wans’ within it to ‘W’.

7 years ago | 0

Answered
error bars in bar plot with categories
This seems to be an XOR situation. Apparently, it is possible to have categorical x-values or errorbar bars but not both. Th...

7 years ago | 1

| accepted

Answered
Remove the 50 Hz Hum from a Signal
The designfilt call designs a second-order Butterworth filter. It appears to be correct when I analyse it with freqz. Without ...

7 years ago | 0

Answered
Fitting 2 data sets simultaneously using two different equations with some shared fit parameters.
Try this: global_fit_data = [A; B].'; % A and B are vectors of size 1X85 t = (0:10:840).'; global_fit_function = @(p,t) [p(3...

7 years ago | 1

| accepted

Answered
how to i change the x-axis from time to angle with this data?
Without your code, an exact respoinse is not possible. See for example XTick and XTickLabel.

7 years ago | 0

Answered
How can I solve a set of equations using a function handle?
Try this: BigLambdaFunction = @(p,t,T) 1 - p(1).*((p(2)-(t-T))./(p(2)-t)).*exp((p(1).*T)./p(2)) biglambda = [ 0.0455 0....

7 years ago | 0

| accepted

Answered
@FinalProject_ode must return a column vector (solved)
Assuming all the elements are scalars, either transpose ‘dydt’ or put semicolons between the elements: dydt = [dPPARuFFA; dPPA...

7 years ago | 0

Answered
How to fix the code
If you want to set ‘N’ to the row size of ‘DATA’, this is preferable: N = size(DATA,1); Perhaps you intend to read the entir...

7 years ago | 0

| accepted

Answered
Should I shift my fft function?
It depends on the result you want. The shifted version plots the negative and positve frequencies (the Fourier transform is sym...

7 years ago | 0

| accepted

Answered
Matlab Outputting answers as fractions
You are still in the Symbolic Math Toolbox environment. Try one of these (depending on the rresult you want): X = vpa(linso...

7 years ago | 5

| accepted

Answered
Highpass Filter Sound Help
Store the filtered signals in a cell array (easiest). Then use the playblocking function to play them back one after the other ...

7 years ago | 0

| accepted

Answered
Why it plots more than just one point and how do I get rid of them
The code plots more than one point because you told it to. Revised code: function xp=h2(t,x) xp=zeros(2,1); xp(1)=(x(2)) ...

7 years ago | 0

Answered
how to get rid of error which says too many output arguments
The ‘test3’ function needs to be: function xdot = test3(t,x) xdot(1)=x(2); xdot(2)= 10*(-2*x3 + x2); xdot=xdot'; end and ...

7 years ago | 0

Answered
Add error bars to grouped bar plot
See: Adding standard error bars to grouped bar graph

7 years ago | 0

Answered
Multiple outputs from anonymous function
One option is to have the two outputs to one vector, then separate them in a subsequent assignment: demo_fcn = @(in) [in(1) in...

7 years ago | 0

Answered
How to show surface plot of 2D data?
Try this (with your own vectors): x = rand(10,1); % Create Data y = rand(10,1); ...

7 years ago | 1

| accepted

Answered
Mldivide gives rank deficency when solving for large full system
See if the lsqr function will do what you want. Another option is to use pinv to do the matrix inversion (not normally an app...

7 years ago | 0

Answered
i am not able to import excel sheet
One approach would be to open Excel, then save your spreadsheet as a .txt file (likely a comma-delimited text file). Then impor...

7 years ago | 0

Answered
diff makes M less than what i want by 1 elment and i want to have second derivaitve numircal
Use the gradient function. Specifically: k = 0:0.1:5; figure(4) E=(k.^2)*(1.0540^2)/(2*1000*9.1); fx=gradient(E)./grad...

7 years ago | 0

Answered
Hello, how to solve this equation E*I*k^4-m*v^2*k^2+2*m*v*w*k+(m+M)w^2=0 numerically where w is variable,
Supply all the scalar parameters, then: Eqn = @(w) E*I*k^2-m*​v^2*k^2+2*​m*v*w*k+(m​+M)w^2; w0 = 42; [w,fval] = fsolve(Eqn, ...

7 years ago | 0

| accepted

Answered
Plot ODE Bond Price Model
Not enough information, so I created the missing variables: tv = linspace(0, 100, 25); % Time...

7 years ago | 0

Answered
Simple system of ODES with starting condition
The only (relative) mistake I can see is that it is not good to use global variables. Pass the values as extra parameters inste...

7 years ago | 0

Answered
HOW TO FİND PEAKS OF FFT
I recognise my code! The second plot call is almost correct. Try this: [pks, locs]=findpeaks(x(Iv)); plot(Fv(locs), p...

7 years ago | 0

| accepted

Answered
Testing a created function
First, it is best not to use ‘ans’ as a variable, since it is the default variable and can be overwritten. Second, the the if...

7 years ago | 0

| accepted

Answered
Solve a system of linear equations in matrix form
The problem is that the system is sparse, so you need to use sparse functions with it. Try this: Left = [1 -1 0 0 0; 1 0 0 ...

7 years ago | 0

| accepted

Load more