Community Profile

Ameer Hamza

Hong Kong Polytechnic University

3 099 total contributions since 2016

3.1416

View all

Contributions in
View by

tf function doesn't work
You need to have the control system toolbox: https://www.mathworks.com/help/control/index.html for using tf() function. It seems...

environ 10 heures ago | 0

How can I assign a number to another number and then create sequences in which I can swap them at will?
Check this code numbers=1:40; numbers_b=[11:14, 21:24, 31:34, 41:44, 51:54, 61:64, 71:74, 81:84, 91:94, 101:104]; assigned=[n...

environ 10 heures ago | 0

| accepted

Integrate planck function between two intervals
Check this code and compare it with your code to see the mistakes. c1 = 27.742*10.^8; c2 = 1.43878*10.^4; sigma = 5.67*10.^-8...

environ 11 heures ago | 0

| accepted

Plotting coordinate points using plot()
It is giving you points, but the size is so small that they are barely visible. Also, transpose is not needed here. The followin...

environ 11 heures ago | 0

Help.. how would i get 7* to 1*
You can run the for-loop in reverse order too N = 7; for mm = N:-1:1 % equivalent to mm = flip(1:N) for nn = 1:mm ...

environ 11 heures ago | 0

| accepted

2d to 3d array conversion
First convert tables to arrays and then use cat() for i=1:14641 a{i} = readtable(strcat('output_',num2str(i),'.csv')); end a...

environ 12 heures ago | 0

VolumeViewer ScaleFactors not working in R2018b
ScaleFactor was not present in R2018b: https://www.mathworks.com/help/releases/R2018b/images/ref/volumeviewer-app.html?searchHig...

environ 14 heures ago | 0

expanding a given function as a power series?
You need the symbolic toolbox for this problem! syms x y f(x) = x^3+2*x; g = f(exp(y)); g_approx = taylor(g, y, 'Order', 1...

environ 15 heures ago | 1

| accepted

how to get data from an interval
You can use logical indexing. Add these lines at the end of your code x = sol.x; y = sol.y; idx = (x > 50) & (x < 180); fi...

environ 17 heures ago | 0

| accepted

How can I change the linewidth in a pzmap?
This is one way fig = figure(); ax = axes(); s = tf('s'); G=s+3/((s+4)*(s^2+1)); pzmap(ax, G); l_zero = findall(ax, 'tag...

environ 17 heures ago | 1

Count using mod function
The following example show how to find the even number in a vector using mod(). You can extend it to other cases x = [1 4 3 2 1...

environ 17 heures ago | 0

You can generate the sine wave using sin() function: https://www.mathworks.com/help/matlab/ref/sin.html. Note that you can get a...

environ 18 heures ago | 0

Averaging oscillating data points
Try lowpass filter if you have signal processing toolbox data = readmatrix('SampleTempData.xlsx'); t = data(:,1); x = data(...

environ 18 heures ago | 1

My Colored image gets read as a bw image

environ 19 heures ago | 0

| accepted

syntax of matlab code
You can write-click on the name of the function and click open "Function name". It will take you to the corresponding function u...

environ 21 heures ago | 0

Entering Data to plot Graphs
Just entering as an array would be fine. See plot(): https://www.mathworks.com/help/matlab/ref/plot.html. Here is a very simple ...

environ 21 heures ago | 0

How can I coding this function correctly?
Since this is a homework question so I won't be giving exact code, but you can read the documentation of the following functions...

environ 22 heures ago | 0

How to make a text figure close after an input command, how do I also make a text figure show up after an input command
You can use close() x = {'Choose the number you would like to solve'; '1 = Kinetic Energy';'2 = Potential Energy';'3 = Net Forc...

environ 22 heures ago | 0

The Eigenvalues of a large matrix don't cross each other when plotted
Yes, this is a very common problem with MATLAB's eig function, and John has created this excellent package to solve this problem...

1 jour ago | 0

| accepted

perform matrix operation without for loop
Following code is equivalent xe = zeros([size(exp_data) numel(beta)]); mask = exp_data > 1.5; for m = 1:numel(beta) xes ...

1 jour ago | 0

Can someone help me write a code to generate a random matrix like the one in the picture?
See blkdiag(): https://www.mathworks.com/help/matlab/ref/blkdiag.html. It is made specifically for this purpose. For example d ...

1 jour ago | 1

| accepted

Set facecolor in app designer
No need to pass app.UIAxes in these lines set(pie(1),'facecolor',[255 85 180]./255); set(pie(2),'facecolor',[255 0 0]./255);

1 jour ago | 0

| accepted

Calculating seasonal mean of precipitation from 25 years daily data
See retime(): https://www.mathworks.com/help/matlab/ref/timetable.retime.html

1 jour ago | 0

Diagonal slices of 3D array
The question is not entirely clear, so the following is my guess, but such a problem can be solved using sub2ind(). C = % 2N*N*...

1 jour ago | 1

Ues waitforbuttonpress for key press only
Instead of waitforbuttonpress, use KeyPress callback for the figure object: https://www.mathworks.com/help/matlab/ref/matlab.ui....

1 jour ago | 0

Direction between points from [0,360]
Add 2pi to negative values. x = -1; y = -1; theta = atan2(y, x); if theta < 0 theta = theta + 2*pi; end

1 jour ago | 0

How can I crop several regions from a video and plot all the signals of rgb values in the same graph?
Check this code vid = VideoReader('respiration.mp4'); I = cell(1, 3); rects = zeros(3, 4); numFrames = vid.NumFrames; % go...

1 jour ago | 0

| accepted

Change filename of all files in folder to have underscore instead of space
Something like this d = uigetdir(pwd, 'Select a folder'); files = dir(fullfile(d, '*.s2p')); for i = 1:numel(files) or...

1 jour ago | 0

Create vector of monthly means from arbitary time format and vector of sampled temperatures.
See retime(): https://www.merriam-webster.com/dictionary/retime . For a more specific example, please attach a sample dataset.

1 jour ago | 0