Answered
Array indices must be positive integers or logical values
You can do this by Iout = double(Io)

2 years ago | 0

Answered
how to solve a second-order differential equation set with parameter using Euler's method?
Actually, dy is the derivative of y with respect to t. The code you give is absolutely right. So you see Euler's Method If y...

2 years ago | 0

Answered
I want the same randomly split dataset for all the network so that i can compare the results.
You can save imdsTrain, imdsValidation for the first run And then use load to get imdsTrain, imdsValidation for three different...

2 years ago | 0

| accepted

Answered
How to order a set of unordered points
Use boundary(x,y) function load('pts.mat'); x=X_pts(:,1); y = X_pts(:,2); k = boundary(x,y,1); plot(x(k),y(k)) set(gca,'Y...

2 years ago | 0

| accepted

Answered
How to solve system of first order ODE's by forming matrix
Do not use syms, because without syms, the code runs faster A = [2 5 1; 7 9 0; 4 1 3]; odefun = @(t,Y)A*Y; tspan = ...

2 years ago | 0

| accepted

Answered
Calculating number in a string
Then do following code for i = 1:1:nLines fprintf('%d: %s\n',i,fileStr{i}) end fprintf('This file has %d lines', nLines)

2 years ago | 0

| accepted

Answered
I want to throw the error that comes with entering a non number in a numeric only input
n = str2num(input('Please enter a number:\n','s')); if(isempty(n)) error('You are entering a non number in a numeric only inpu...

2 years ago | 0

| accepted

Answered
How do I only display the 5 answers in the command window once?
s = [1 2 3 4 5]; h = [1 2 3 4 5]; SA = zeros(size(s)); for i = 1:5 s1 = s(i); h1 = h(i); SA(i) = equTriPris...

2 years ago | 0

| accepted

Answered
I want to find out vector subtraction of co-ordinates of 2 adjacent nodes of an element. How to proceed?
% if you have nodes and elements % nodes n-by-3 % elements m-by-8 % Then node1 = 1; node2 = 3; xrelative = abs(nodes(node1...

2 years ago | 0

| accepted

Answered
How to fix: Index Exceeds Matrix Dimensions
Hi, friend ode45 function outputs a struct with size 1x1 when only one argument is for output data. If you want to output x sol...

2 years ago | 0

| accepted

Answered
Why do I receive Not enough input arguments?
I just give a minor correction to your code function [SA]=equTriPrismSurfArea(s,h) SA=((sqrt(3)/2)*(s^2))+(3*s*h); end Save...

2 years ago | 0

| accepted

Answered
One Dimensional Laplace Equation with Source term.
Hi, friend I have found your boudary conditions are applied at the centre of control volumes of both ends rather than on the b...

2 years ago | 0

| accepted

Answered
Creating a matrix of logical arrays using an exsiting matrix
Use eye num_labels = 10; Y = [1;2;3;4;3;2;4;5;3;3;5;7;8]; % example Y E =eye(num_labels)==1; Your_matrix = E(Y,:) Then You...

2 years ago | 0

| accepted

Answered
How can I use '$...$' Environment in xticklabel with matlab2tikz?
Just use xticklabels({'\$1\$','','\$2\$','','\$3\$','','\$4\$','','\$5\$',''}); rather than xticklabels({'$1$','','$2$','','$...

2 years ago | 0

| accepted

Answered
Adding constraints to function plots in 2-D and 3-D
Hi, I have translated the Cartesian to polar system so as to satisfy your requirement f = @ (x , y ) x .* sin( x .* y ); min...

2 years ago | 0

Answered
what happened to my install ?how to solve this proplem?
你好,饶倩榕同学 在运行matlab安装程序之前,请关闭杀毒软件,特别是360;然后点击安装包安装时,请右键以管理员方式运行。 Hello, Rao Qianrong Before running matlab installer, please t...

2 years ago | 0

Answered
symbolic calculation for series
Hi friend, Just define U as a symbolic array, it works in my matlab syms x t syms U [5,1] % I think what you need is 5-by-1 m...

2 years ago | 0

| accepted

Answered
How can I count number of dates over 100 degree F?
dates = readtable('your_dates_file'); % assume that your dates fie has only one column temps = readtable('your_temperature_fil...

2 years ago | 0

| accepted

Answered
How to remove indexed set of rows from a cell array
Try this logical_indices = arrayfun(@(i)corb{i,1}(1)>100000&corb{i,1}(1)<300000,(1:1:size(corb))'); row_indices = find(logical...

2 years ago | 0

Answered
write a 'for' loop numbers in a single row matrix
Hi, MOzhdeh Salimi Here I donot know your tiff file but I have written code for you! VF = rand(100,100); Tnormal = rand(100,1...

2 years ago | 0

| accepted

Answered
Creating a mxn matrix that is all zeros except for the middle row and middle column which are 1s
M = [0,0,0,1,0,0,0; 0,0,0,1,0,0,0; 1,1,1,1,1,1,1; 0,0,0,1,0,0,0; 0,0,0,1,0,0,0]; Once for all Or you can do a = zeros(5,7); ...

2 years ago | 0

| accepted

Answered
How to plot multiple box plots on same graph with same size vector?
Hi, just change line 1 vol = [D1(:,1);C1(:,1)]; to vol = [D1(:,1), C1(:,1)];

2 years ago | 0

| accepted

Answered
Setting 3D plot's centre at origin
try this set(gca, 'XAxisLocation', 'origin', 'YAxisLocation', 'origin','ZAxisLocation', 'origin')

2 years ago | 0

Answered
Squeezing NaN's out of a square matrix to make a smaller square matrix
[p,q] = size(M); M(isnan(M))=[]; M = reshape(M,p-1,q) Then M = 2 1 1 1 1 3 3 2 ...

2 years ago | 0

| accepted

Answered
Number of Bacteria.
Here you can use symbolic solution syms N(t) t eq = diff(N)==log(3.32)*N N = dsolve(eq,N(0)==100) N_1dot5_hour = eval(subs(N...

2 years ago | 0

| accepted

Answered
How to store conditional values during iteration by using Ode45?
You can define a table to store the data including the conditional values function main t0=0; tf=15; a0=1; T = table(); gl...

2 years ago | 1

| accepted

Answered
If statement in a for loop
You can do like this A = mat2cell(rand(40,40)+0.5, [10 10 10 10], [10 10 10 10]); % A is your data randomly generated, you ca...

2 years ago | 1

Answered
I want to draw dual phase portraits in a 4x4 linear differential equation system. My codes contain 4 variables as below (x1, x2, y1, y2). For a given coefficients matrix, when
Looks like an ode function, so use matlab ode solver to solve it. Here I give an example of ode 45. A = rand(4,4); tspan = [0...

2 years ago | 0

| accepted

Answered
Create cylinder roll based on height data
You need map the length and the circumference to your true cylinder. cylinder_true_length = 20; cylinder_true_radius = 5; len...

2 years ago | 0

| accepted

Answered
reduce samples on a 3d array
Use interp1 my friend, if a is the 160x120x30000 data that you said. [m,n,p] = size(a); a = reshape(a,m*n,p); nSeries = p; ...

2 years ago | 1

| accepted

Load more