답변 있음
How to remove rows from an array where there is a 1 in a logical array of the same dimensions
The one below is just an example of how to use logical indexing for your problem. data = ones(1,100); data(randi(100,1,10)) = ...

3년 초과 전 | 0

답변 있음
Help with coding a model
I think this could be the solution to your problem % Parameters L = 80; gamma = 1e-2; R_0 = 0.7; beta = R_0*...

3년 초과 전 | 1

| 수락됨

답변 있음
How do I use a variable assigned in one function to call another function?
The code does not global variables at all a = 5; b = 10; x = name1(a,b) y = name2(x,b) function out = name1(var1,var2) ...

3년 초과 전 | 0

답변 있음
Plot polynomial using Eueler's method
so, initially, you calculate the analytical derivative of the function using the symbolic environment syms x y = x^3+x^2-12*...

3년 초과 전 | 1

| 수락됨

답변 있음
Fill area inside a single curve with color without an outline?
You should remove unnecessary spaces (' EdgeColor' --> 'EdgeColor'). A = [3.538283063 300.2169197 3.712296984 321.9088937 ...

3년 초과 전 | 0

| 수락됨

답변 있음
Create an array from file names to find if any files are missing
Take this example, where there should be a total of 4 files but file #3 is missing n = 4; % nu...

3년 초과 전 | 0

답변 있음
Need to fill out skipped rows in a matrix
Take this example complete = [(1:10)',rand(10,1)] partial = [sort(randperm(10,6))',rand(6,1)] You can apply the following to ...

3년 초과 전 | 0

| 수락됨

답변 있음
ismember for cell arrays of different sizes
bin_list = {[1], [1,7], [1,7], [1,7,9], [2,8], [3], [1,7]}' cellfun(@(x)ismember(1,x),bin_list)

3년 초과 전 | 0

| 수락됨

답변 있음
Plot elipses with a foci based on equations to plot flowers
The code below does the job drawing the figure, but not the coloring. I can't run it online (takes too long). clear,clc figur...

3년 초과 전 | 1

| 수락됨

답변 있음
How can i plot dy/dx function?
You can use deval in combination with solution structure. xspan = (30:0.1:900); y0 = 0; opts = odeset('AbsTol',1e-8,'RelTol',...

3년 초과 전 | 0

| 수락됨

답변 있음
What is wrong with the function code when it can work perfectly without function code
The value of for tol differs of two orders of magnitude in the examples you gave (i.e., you used 0.001 in the function call, 0.0...

3년 초과 전 | 0

답변 있음
Im trying to use the integral function without any success...
syms t f = exp(-t/3)* sin(t^2); I = int(f,t,1,4) This means int cannot compute the value of the definite integral. You could ...

3년 초과 전 | 0

답변 있음
I'm getting an error (Index in position 1 exceeds array bounds)
Do this instead ind_out = signal(1,:) > max_thresh; %find index of point>thresh onset = signal(ind_out,1); %return onset ...

3년 초과 전 | 0

답변 있음
Count occurances on multidimensional matrix with multiple criteia on different dimnesions
A(:,:,1) = [ 90 95 90 80;... 70 90 95 70;... 60 90 90 60;... ]; A(:,:,2) ...

3년 초과 전 | 0

문제를 풀었습니다


Magic is simple (for beginners)
Determine for a magic square of order n, the magic sum m. For example m=15 for a magic square of order 3.

3년 초과 전

문제를 풀었습니다


Make a random, non-repeating vector.
This is a basic MATLAB operation. It is for instructional purposes. --- If you want to get a random permutation of integer...

3년 초과 전

문제를 풀었습니다


Number of 1s in a binary string
Find the number of 1s in the given binary string. Example. If the input string is '1100101', the output is 4. If the input stri...

3년 초과 전

문제를 풀었습니다


Create times-tables
At one time or another, we all had to memorize boring times tables. 5 times 5 is 25. 5 times 6 is 30. 12 times 12 is way more th...

3년 초과 전

문제를 풀었습니다


Return the first and last characters of a character array
Return the first and last character of a string, concatenated together. If there is only one character in the string, the functi...

3년 초과 전

답변 있음
Can someone explain to me how to code the Tangent line and Normal line
syms x m b yt f(x) = 3^x+3*x+2; % Function m = diff(f,x) % Slope of tangent ...

3년 초과 전 | 0

답변 있음
Finding specific values from a matrix
See the example below (I used a smaller array for better readibility) Values = randi(200,1,20) lower_limit=30; upper_limit=10...

3년 초과 전 | 0

| 수락됨

답변 있음
Using fsolve in simulink with a different equation each time
In Simulink, you can keep a as a generic parameter syms x a eqn = (450 + 75 * cos(x) - 450 * cos(a))^2 + (110 + 450 * sin(a) -...

3년 초과 전 | 0

| 수락됨

답변 있음
find and store the index value of maximum or minimum value of cell array
Example for row = 1:613 yourcellarray(row,1) = {randi(100,200,1)}; end yourcellarray yourcellarray{1} Above is just an...

3년 초과 전 | 0

답변 있음
Help with Graphing Difference Equations
n = 10; x = zeros(1,10); x(1) = 2; x(2) = 5; for idx = 3:n x(idx) = 5*x(idx-1)-6*x(idx-2); end semilogy(1:n,x)

3년 초과 전 | 0

| 수락됨

답변 있음
Running for loop on an equation
I suspect you want to do something like this S = [ 1/2, 1/3, 1/2, 1/3, 1/3, 1/2;... 1/2, 0, 0, 0, 0, 0;... ...

3년 초과 전 | 1

답변 있음
perimeter , area of circle
You just need to change the arguments in fprintf, since you must have accidentally swapped them. r = 1; P = pi * 2 * r; S = p...

3년 초과 전 | 0

| 수락됨

답변 있음
How to apply stop time condition with multiple time intervals?
n=100; time = 0; for i = 1:n if sum(time) >= 35 fprintf('You run out of time') break end ...

3년 초과 전 | 1

| 수락됨

답변 있음
How do I find a maximum within a certain range
Take this example dataset x = linspace(0,10,100); y = randi(10,1,100).*sin(x); plot(x,y) Now assume you want to find the max...

3년 초과 전 | 0

답변 있음
Method of lines to solve unsteady state PFR with multiple reactions
I deleted many commented lines for clarity. clear, clc k0 = [0.1023 0.0011 0.0129 0.0000001 0.0008 0.000001 0.163 0.5 0.01 0...

3년 초과 전 | 1

답변 있음
Help with time dependent ODE with a piece-wise component
I think that the problem is that you already defined the ODE system as an anonymous function, therefore there's no need to call ...

3년 초과 전 | 0

| 수락됨

더 보기