Answered
HOW TO CODE AND PLOT EQUATION
You are missing multiplication operator between 'k' and t^n. MR = a*exp(-k*(t^n))+b*t

2 years ago | 0

Answered
least square fitting with a data set
You can use sgolayfilt() or 'smoothingspline' option from curve fitting toolbox. See the answers here for detailed discussion on...

2 years ago | 0

Answered
Coding bug - IF statement
Comparing arrays like this does not work properly with the if-else block. See the output of your comparison >> a=[1;0;0] b=[0;...

2 years ago | 1

| accepted

Answered
How to plot the opposite direction field
Try this quiver(x, y, 1./u, 1./v);

2 years ago | 0

| accepted

Answered
Plotting third order differential equation using ode45
You need to convert this 3-rd order ODE to 3 first order ODEs. Also due to +-1, you have two systems of ODEs. Try following code...

2 years ago | 0

| accepted

Answered
using fzero with arrayfun searching for zeros inside an interval
Create a cell array and then use cellfun() f = @(x) -x.^2+4; C = {[-3 1.9]; [1.95 3]}; sol = cellfun(@(x) fzero(f, x), C)

2 years ago | 1

| accepted

Answered
2D colormap of a polar coordinates function
You will need to use x = -2:0.02:2; [x,y] = meshgrid(x); a1 = 5; r2 = x.^2+y.^2; I = a1 * exp(-5*r2); surf(x,y,I); shad...

2 years ago | 2

| accepted

Answered
How can i get the index of all matrix value
Are you looking for something like this A; B = repmat((1:size(A,1)).', 1, size(A,2))

2 years ago | 0

| accepted

Answered
Plot transfer function with exponential function
An alternative approach: s = tf('s'); G = 4*exp(-s)/(s^2+4*s+4); step(G)

2 years ago | 2

Answered
determine the values of 2 unknowns through nonlinear regression and predict value of equation
There are several ways to do nonlinear regression for a given model in MATLAB. If you have the optimization toolbox, then you ca...

2 years ago | 0

| accepted

Answered
How to plot function with conditions (3d)
You can replace the unwanted values with nan. [x,y] = meshgrid (-2:2:2); z = x.*y; mask = x + y <= 1; z(~mask) = nan; surf...

2 years ago | 0

| accepted

Answered
I'm trying to plot differential equations but it's showing errors.
You are not applying the initial condition with solving the ode. Check the following code clc close all syms i(t) di = diff(...

2 years ago | 0

Answered
How could I plot a 3D surface response for 3 independent variables and one dependent variable
First, you need to convert your list of scattered points into a 3D grid using interpolation: https://www.mathworks.com/help/matl...

2 years ago | 0

Answered
Curve fit or spline fit for a wavy function
Use interp1(): https://www.mathworks.com/help/matlab/ref/interp1.html with 'spline' interpolation method.

2 years ago | 0

Answered
fitlm works but polyfit does not work
There is probably NaN somewhere in your dataset. fitlm() ignores those data values. For example x = linspace(0, 1, 10); y = 2*...

2 years ago | 0

| accepted

Answered
matrix for simulating 20 coin tosses
Try this M = randi([0 1], 20, 1000); M_sum = sum(M); freq = accumarray(M_sum(:), 1, [20 1]); bar(1:20, freq) xlabel('Numb...

2 years ago | 0

| accepted

Answered
how to read images from matlab? matlab image processing
You can write a for-loop and save all the images in a cell array P = 'C:\Users\sy\Desktop\miasdbv1.21\MIASDBv1.21'; D = dir(fu...

2 years ago | 1

Answered
how can I convert comma with semicolan and then again point with comma for a multiple csv files?
Try this str = fileread('scope_0.csv'); str = replace(str, {',', '.'}, {';', ','}); f = fopen('outfile.csv', 'wt'); fprintf(...

2 years ago | 0

| accepted

Answered
Convert a value into a Matlab syntax string
You can do something like this exStruct.value = [1 0 0;0 1 0;0 0 1]; out = ['[' strjoin(compose(repmat(' %d ',1,3), exStruct.v...

2 years ago | 1

| accepted

Answered
How can I remove successive repeated numbers (column wise) from a matrix?
Easy peasy A = [11 35 57 45 94; 26 45 69 45 86; 58 45 39 96 35; 87 59 64 56 45] B = A(:); or B = reshape(A...

2 years ago | 0

| accepted

Answered
Find a transfer function from plot data
The easiet option is to use the system identification app: https://www.mathworks.com/help/ident/ug/working-with-the-system-ident...

2 years ago | 0

Answered
Indexing between two lists
It seems that you can just use round() on the 3rd column, but since that solution is so obvious, there might be some other reaso...

2 years ago | 0

| accepted

Answered
Error using symengine, Either base or exponent must be a scalar.
You are overwriting x and y inside the for-loop. The syntax for vpsaolve() is also incorrect. syms x y r = [3, 3.5, 4, 4.5, 5...

2 years ago | 1

| accepted

Answered
Matlab ode solver - putting condition in function
The easiest option might be to do this after getting the solution from ode23s. For example [t, y] = ode23s(..) idx = find(y<...

2 years ago | 0

| accepted

Answered
capture a snapshot and saving it to a matrix variable
Are you using it inside App designer? Remove the line clear all; clc; close all

2 years ago | 1

Answered
How can I transform a transfer function to a filter?
Filtering through a transfer function is equivalent to simulating the dynamic control system with an unfiltered signal at the in...

2 years ago | 1

| accepted

Answered
Error using readcell ...Input must be a row vector of characters or string scalar.
This error is thrown inside the try-catch block. So we can't see what is causing the error, but the most common reason is that y...

2 years ago | 0

Answered
Please how to calculate the number of 1 and 0 in each position in a binary vector
Try this str = '00000001111000000000111111100000000000000011111111'; x = diff([0 find(diff(str-'0')) numel(str)]) Result >> ...

2 years ago | 0

| accepted

Answered
Writing differential equation for plot
Try this syms x(t) d1x = diff(x); d2x = diff(x,2); ode = d2x == -sign(x + d1x); cond = [x(0)==1 d1x(0)==0] sol = dsolve(...

2 years ago | 0

| accepted

Answered
How to store values of rows in a matrix where the 3rd column is a multiple of 100?
Use can use rem() to filter the rows where the third column is multiple of 100 and then use logical indexing M; % nx3 matrix i...

2 years ago | 2

| accepted

Load more