Community Profile

# Ameer Hamza

### Hong Kong Polytechnic University

2,831 total contributions since 2016

View all

Contributions in
View by

Finding min and max of ODEs
See this example % defining the time range: T=12; trange=[0 T]; % defining initial values (concentrations) for c,s,e i p: c...

1 month ago | 0

| accepted

How to solve "A and B must be floating-point scalars"?
In a symbolic toolbox, you need to use int() instead of integral to find a symbolic integration. Try following code syms v w x ...

1 month ago | 0

| accepted

How do I get the equation and display on the graph for line of best fit?
Try this x=[0.200 0.100 0.067 0.050 0.040 0.033 0.025]; y=[0.214 0.158 0.130 0.125 0.136 0.115 0.107]; axis([0 0.025 0 0.02...

1 month ago | 1

| accepted

Not enough input arguments
It seems that you are trying to solve a matrix differential equation. If you are using ode45, one possible way this error can oc...

1 month ago | 0

| accepted

How can i use 1d signals as input for classification?
If you refer to deep learning-based classification, MATLAB's deep learning toolbox supports the classification of time-series, f...

1 month ago | 0

How to make animtion of 3D surface plot?
See this example using variable 't'. Adapt it according to your requirement %suface plot; x=-20:1:20; y=-20:1:20; [x,y]=mesh...

1 month ago | 1

| accepted

How can I solve this question? And the ODE equation made me confused.
See bvp4c() for boundary condition problems. Something like this EI = 1.3e7; q0 = 30e3; T = 20e3; L = 4; xmesh = linspace...

1 month ago | 1

| accepted

HELP me!!! eigen value!!!!!
See the eig() function: https://www.mathworks.com/help/releases/R2020a/matlab/ref/eig.html to find all the eigenvalues. Use max(...

1 month ago | 2

| accepted

how to make a smooth sepectrum??
See smoothdata(): https://www.mathworks.com/help/releases/R2020a/matlab/ref/smoothdata.html. Pass the X_mags vector through smoo...

1 month ago | 0

How to bulid multiple loops with logic operators
You mistakenly typed 1i (imaginary number in MATLAB) instead of i elseif (stress_w1_1(i) > stress_w1_2(1i)) ...

1 month ago | 0

| accepted

Patch color error "Vectors must be the same length."
Using for-loop seems to be the simplest solution in this case. x =[ 1 2 1 2 2 3 2 3]; y =...

1 month ago | 0

Generating Block Matrix Dynamically
This example show how to use blkdiag to create such a matrix M = [0.7071 0.7071 0.7071 0.7071]; n = 4; M_cell ...

2 months ago | 0

| accepted

Can anyone help with this error? (I just want to see the contour of the bluish area at the bottom of the image)
You need to specify a single channel image to imcontour(). For example, just provide the blue channel imcontour(I(:,:,3), 3) o...

2 months ago | 0

Saving figures with minimum 300dpi in online matlab
Use exportgraphics() to save the figure exportgraphics(gcf, 'test.jpg', 'Resolution', 300) saves currently active figure windo...

2 months ago | 2

| accepted

How can I write this exponential function in matlab
One way to write this is to create an anonymous function f = @(t) 0.2*exp(-1i*(8*pi*t-pi/2))+0.585*exp(-1i*(7*pi*t-deg2rad(78.6...

2 months ago | 0

How to run an .exe file and open an input .txt file to that
If it accepts through command line as an input argument then you can try this system('C:\NEC-PRO16\BIN\NECWINP.EXE input.txt') ...

2 months ago | 0

How can I write these functions to the press
You can use ode45() to solve such a system of ODEs. ic = [2; 4]; xspan = [0 1]; [x, Q] = ode45(@odeFun, xspan, ic); y_sol = ...

2 months ago | 0

plotting a matrix values as a bar diagram
See boxplot() or boxchart() boxplot(s.') It will show the range of values in each row.

2 months ago | 0

| accepted

Split table column into multiple columns within the same table based on a specific delimiter
Try this load('Detections.mat'); val = cell2mat(cellfun(@(str) {sscanf(str, '%f,').'}, Click.avrg_spectrum)); new_table = [Cl...

2 months ago | 0

| accepted

Renaming multiple subfolders within folder
Something like this files = dir('P_6CMBCF_*'); for i=1:numel(files) filename = files(i).name; new_filename = [filena...

2 months ago | 1

| accepted

Is it possible to rewrite these equation set to matrix form?
These variables are nonlinearly related, so not sure how do you want to write in matrix form. Also, it is unlikely that it will ...

2 months ago | 0

| accepted

Can I make MATLAB use a custom copy method when creating an array of my class?
It seems like subsasgn() https://www.mathworks.com/help/matlab/ref/subsasgn.html could be helpful in this case. You can control ...

2 months ago | 1

| accepted

n th Fibonacci number with function
As compared to using for-loop, an alternative approach is to use a closed-form expression of the Fibonacci sequence as given her...

2 months ago | 0

Saving heatmaps as image
If you are using R2020a, you can use exportgraphics() ans specify the handle of graphic object. n2E = rand(10); % for example ...

2 months ago | 1

| accepted

Help me with code to solve for loop to solve ODE
Try this code tspan = [0 500]; ic = [1; 0; 0; 0; 0]; [t, p] = ode45(@odeFun, tspan, ic); plot(t, p) legend({'p', 'p\_dot1...

2 months ago | 0

| accepted

You can use the WindowButtonMotionFcn callback of the figure object. Run the following example fig = figure(); ax = axes(fig);...

2 months ago | 0

| accepted

Error using atan2 Inputs must be real.
It gives the value of th4, but the output is in the symbolic format. Convert it into a floating-point value by using double(). C...

2 months ago | 0

| accepted

How to solve higher order nonlinear ode in matlab?
You need to convert the higher-order (say n-th order) ODE equation into a system of n first-order ODE equations. See this exampl...

2 months ago | 2

Load and do operations for multiple files in a loop
Try something like this filePattern = fullfile('ATA*.mat'); %the 306 files are in the following format ATA 1....306.mat theFil...

2 months ago | 0

| accepted