Answered
vpaintegral() returns wrong answer for g(t) = (mod(t,5))^2
This seems to be a bug. You can use the following workaround syms t real g(t) = (t-floor(t/5)*5)^2 fplot(g, [0 10]) vpainteg...

5 years ago | 1

Answered
How can I plug the symbol vector into function.m file for ode solving?
Are you manually pasting your symboling expression in the ODE() function? You can use odetovectorfield(): https://www.mathworks....

5 years ago | 0

| accepted

Answered
Inserting Elements in middle of 1-D, 2-D, N-D Array
interp1() is suitable for such cases. X = [1 2 3 4 5]; n_new = 9; X_new = interp1(linspace(0,1,numel(X)), X, linspace(0,1,n_n...

5 years ago | 0

| accepted

Answered
delete elements from the given array
Try this X=[1,2,3,4,5,6]; idx = find(mod(X,2)==0); X(idx(1:end-1)) = []

5 years ago | 0

| accepted

Answered
Comparing uneven sized matrix and delete rows which are not common
Try this code D = readmatrix('Dir.txt'); E = readmatrix('Esq.txt'); [tf, idx] = ismember(D(:, [2 5]), E(:, [2 5]), 'rows');...

5 years ago | 1

| accepted

Answered
How to implement load function into MatLab Coder
I haven't tried this myself, but this link shows that MATLAB provides C++ API to load .mat files: https://www.mathworks.com/help...

5 years ago | 0

| accepted

Answered
average of first element of every cell
The exact solution depends on how your data is structured. I guess the following will work Average_Vector = mat2cell(mean(cell2...

5 years ago | 0

| accepted

Answered
Export a structure into an excel file, with fieldnames as column headers.
Your struct contain data in row format. First convert it to column format before converting the struct to a table() my_struct; ...

5 years ago | 0

Answered
Read files from folder and subfolder
You can use dir() and for-loop to iterate over files in a folder to process them. This link shows a general template: https://ww...

5 years ago | 1

| accepted

Answered
possible to use the terminal command in matlab script?
You can use system(): https://www.mathworks.com/help/matlab/ref/system.html. However, note that it does not use the same $PATH v...

5 years ago | 0

| accepted

Answered
Multi input convolutional neural network
It is possible to design such a network in MATLAB if you have the deep learning toolbox. The easiest way is to open the Deep Net...

5 years ago | 1

| accepted

Answered
annual Interest rate - Calculation
This is not really a MATLAB question. You can get more information about this on some forums related to economics and finance. F...

5 years ago | 0

Answered
Different value putting on different columns in matrix
You can use repmat() x = [2 0.25 3 1 7]; n_rows = 4; M = repmat(x, n_rows, 1) Result >> M M = 2.0000 0.2500 3...

5 years ago | 0

| accepted

Answered
Decimal places for value stored
You can use round() x=4.21; h=0.001; f=@(x) x^3 + 8*x^2 + 23*x +3; f2_prime = (round(f(x+h),4)-2*f(x)+round(f(x-h),4))/(h^2)...

5 years ago | 0

| accepted

Answered
Simulating empirical formulae with negative powers and 5 different variables
Yes, you can write this in MATLAB. You will need to change to valid variable name % random values Lambda = 1; T = 2; S = 0....

5 years ago | 0

| accepted

Answered
features extraction for images with different features size in a matrix error?
You can use a cell array imds=imageDatastore('E:\dataset test','IncludeSubFolders',true,'LabelSource','foldernames'); [imds_5k...

5 years ago | 1

| accepted

Answered
Implementing a shift register into a Matlab function
To save a variable between different iterations of MATLAB function block in Simulink, declare it as persistent. For example, if ...

5 years ago | 0

| accepted

Answered
refer to the value of a variable referenced by the value of another variable
datetime() supports several of the operators supported by numeric types, including comparison operators. For example, check the ...

5 years ago | 0

| accepted

Answered
Solving a system of equations in a loop efficiently
vpasolve() uses the symbolic toolbox, which is inherently slow. I guess you can use several-fold speed gain if you use a numeric...

5 years ago | 0

| accepted

Answered
Setting maximum and minimum limits from cumsum function
for-loop might be the most efficient solution A = [1, 4, 3, 3, 1, -2, -5, 1, 2, 3, -5, -5, 1, 1, 1, 3]; B = zeros(size(A)); B...

5 years ago | 1

| accepted

Answered
How to write exponential integral in equation?
You can use expint() function N = 1; U = 2; r = log2(exp(1))*exp(N/U)*expint(N/U) Result >> r r = 1.3315 If you have...

5 years ago | 0

| accepted

Answered
Extracted data added into one column, how can data be assign into different columns
You can define res as matrix and fill its different columns folder = fullfile('C:','Users','muhammad','Desktop','Velocity'); f...

5 years ago | 1

| accepted

Answered
Set title in two lines with different font sizes, Part 2
MATLAB just introduced subtitle(): https://www.mathworks.com/help/matlab/ref/subtitle.html in R2020b. You can combine it with ti...

5 years ago | 0

| accepted

Answered
Undefined function 'sinc' for input arguments of type 'double'.
sinc() is available in the Signal processing toolbox or the Symbolic Toolbox. You can check of you have the toolbox installed by...

5 years ago | 1

Answered
How to convert cell arrays inside a cell to matrix?
The exact solution depends on how the data is structured inside the nested cell arrays. The following code shows an example C =...

5 years ago | 2

| accepted

Answered
Cannot run system commands from matlab macOS catalina; zsh:1: command not found: blastp
The command addpath() add the folder to MATLAB's path. ! or system() do not use MATLAB's path. You need to use setenv() to chang...

5 years ago | 0

| accepted

Answered
Using for loops for a matrix
Just use a for-loop. For example M = rand(10, 40); for i = 1:size(M,1) figure(); plot(M(i,:)); end

5 years ago | 0

| accepted

Answered
Curve fitting for degrees less than one
You can choose any exponent you want. For example x = linspace(1, 2); y = 2*x.^0.5 + 4.1*x.^1.2 + 3.3; ft = fit(x.', y.', '...

5 years ago | 0

| accepted

Answered
Combine two vectors a make a Matrix
Try this C = accumarray(coln, rown, [], @(x) {[x; ones(10-numel(x),1)]}, {ones(10,1)}); M = [C{:}];

5 years ago | 1

| accepted

Answered
How can I change the code to get a tangent in the graph
Compare following code with your code to see the mistakes syms x y f(x)=-(sin(x/2)); % Input the function and interval Df=di...

5 years ago | 1

Load more