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

mehr als 3 Jahre vor | 0

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

mehr als 3 Jahre vor | 0

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

mehr als 3 Jahre vor | 1

| akzeptiert

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

mehr als 3 Jahre vor | 0

| akzeptiert

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

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
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)

mehr als 3 Jahre vor | 1

| akzeptiert

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

mehr als 3 Jahre vor | 2

| akzeptiert

Beantwortet
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))

mehr als 3 Jahre vor | 0

| akzeptiert

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

mehr als 3 Jahre vor | 2

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

mehr als 3 Jahre vor | 0

| akzeptiert

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

mehr als 3 Jahre vor | 0

| akzeptiert

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

mehr als 3 Jahre vor | 0

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

mehr als 3 Jahre vor | 0

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

mehr als 3 Jahre vor | 0

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

mehr als 3 Jahre vor | 0

| akzeptiert

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

mehr als 3 Jahre vor | 0

| akzeptiert

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

mehr als 3 Jahre vor | 1

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

mehr als 3 Jahre vor | 0

| akzeptiert

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

mehr als 3 Jahre vor | 1

| akzeptiert

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

mehr als 3 Jahre vor | 0

| akzeptiert

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

mehr als 3 Jahre vor | 0

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

mehr als 3 Jahre vor | 0

| akzeptiert

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

mehr als 3 Jahre vor | 1

| akzeptiert

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

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
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

mehr als 3 Jahre vor | 1

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

mehr als 3 Jahre vor | 1

| akzeptiert

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

mehr als 3 Jahre vor | 0

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

mehr als 3 Jahre vor | 0

| akzeptiert

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

mehr als 3 Jahre vor | 0

| akzeptiert

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

mehr als 3 Jahre vor | 2

| akzeptiert

Mehr laden