メインコンテンツ

Results for


First, I felt that the three answers provided by a user in this thread might have been generated by AI. How do you think?
Second, I found that "Responsible usage of generative AI tools, such as ChatGPT, is allowed in MATLAB Answers."
If the answers are indeed AI generated, then the user didn't do "clearly indicating when AI generated content is incorporated".
That leads to my question that how do we enforce the guideline.
I am not against using AI for answers but in this case, I felt the answering text is mentioning all the relevant words but missing the point. For novice users who are seeking answers, this would be misleading and waste of time.
Mathworks has always had quality documentation but in 2023, the documentation quality fell. Will this improve in 2024?
Hi
I have Matlab 2015b installed and if I try:
ones(2,3,4)+ones(2,3)
of course I get an error. But my student has R2023b installed and she gets a 2x3x4 matrix as a result, with all elements = 2.
How is it possible?
Thanks
A
Athanasios Paraskevopoulos
Athanasios Paraskevopoulos
Last activity 2024 年 3 月 14 日

Can you solve it?
This study explores the demographic patterns and disease outcomes during the cholera outbreak in London in 1849. Utilizing historical records and scholarly accounts, the research investigates the impact of the outbreak on the city' s population. While specific data for the 1849 cholera outbreak is limited, trends from similar 19th - century outbreaks suggest a high infection rate, potentially ranging from 30% to 50% of the population, owing to poor sanitation and overcrowded living conditions . Additionally, the birth rate in London during this period was estimated at 0.037 births per person per year . Although the exact reproduction number (R₀) for cholera in 1849 remains elusive, historical evidence implies a high R₀ due to the prevalent unsanitary conditions . This study sheds light on the challenges of estimating disease parameters from historical data, emphasizing the critical role of sanitation and public health measures in mitigating the impact of infectious diseases.
Introduction
The cholera outbreak of 1849 was a significant event in the history of cholera, a deadly waterborne disease caused by the bacterium Vibrio cholera. Cholera had several major outbreaks during the 19th century, and the one in 1849 was particularly devastating.
During this outbreak, cholera spread rapidly across Europe, including countries like England, France, and Germany . The disease also affected North America, with outbreaks reported in cities like New York and Montreal. The exact number of casualties from the 1849 cholera outbreak is difficult to determine due to limited record - keeping at that time. However, it is estimated that tens of thousands of people died as a result of the disease during this outbreak.
Cholera is highly contagious and spreads through contaminated water and food . The lack of proper sanitation and hygiene practices in the 19th century contributed to the rapid spread of the disease. It wasn't until the late 19th and early 20th centuries that advancements in public health, sanitation, and clean drinking water significantly reduced the incidence and impact of cholera outbreaks in many parts of the world.
Infection Rate
Based on general patterns observed in 19th - century cholera outbreaks and the conditions of that time, it' s reasonable to assume that the infection rate was quite high. During major cholera outbreaks in densely populated and unsanitary areas, infection rates could be as high as 30 - 50% or even more.
This means that in a densely populated city like London, with an estimated population of around 2.3 million in 1849, tens of thousands of people could have been infected during the outbreak. It' s important to emphasize that this is a rough estimation based on historical patterns and not specific to the 1849 outbreak. The actual infection rate could have varied widely based on the local conditions, public health measures in place, and the effectiveness of efforts to contain the disease.
For precise and localized estimations, detailed historical records specific to the 1849 cholera outbreak in a particular city or region would be required, and such data might not be readily available due to the limitations of historical documentation from that time period
Mortality Rate
It' s challenging to provide an exact death rate for the 1849 cholera outbreak because of the limited and often unreliable historical records from that time period. However, it is widely acknowledged that the death rate was significant, with tens of thousands of people dying as a result of the disease during this outbreak.
Cholera has historically been known for its high mortality rate, particularly in areas with poor sanitation and limited access to clean water. During cholera outbreaks in the 19th century, mortality rates could be extremely high, sometimes reaching 50% or more in affected communities. This high mortality rate was due to the rapid onset of severe dehydration and electrolyte imbalance caused by the cholera toxin, leading to death if not promptly treated.
Studies and historical accounts from various cholera outbreaks suggest that the R₀ for cholera can range from 1.5 to 2.5 or even higher in conditions where sanitation is inadequate and clean water is scarce. This means that one person with cholera could potentially infect 1.5 to 2.5 or more other people in such settings.
Unfortunately, there are no specific and reliable data available regarding the recovery rates from the 1849 cholera outbreak, as detailed and accurate record - keeping during that time period was limited. Cholera outbreaks in the 19th century were often devastating due to the lack of effective medical treatments and poor sanitation conditions. Recovery from cholera largely depended on the individual's ability to rehydrate, which was difficult given the rapid loss of fluids through severe diarrhea and vomiting .
LONDON CASE OF STUDY
In 1849, the estimated population of London was around 2.3 million people. London experienced significant population growth during the 19th century due to urbanization and industrialization. It’s important to note that historical population figures are often estimates, as comprehensive and accurate record-keeping methods were not as advanced as they are today.
% Define parameters
R0 = 2.5;
beta = 0.5;
gamma = 0.2; % Recovery rate
N = 2300000; % Total population
I0 = 1; % Initial number of infected individuals
% Define the SIR model differential equations
sir_eqns = @(t, Y) [-beta * Y(1) * Y(2) / N; % dS/dt
beta * Y(1) * Y(2) / N - gamma * Y(2); % dI/dt
gamma * Y(2)]; % dR/dt
% Initial conditions
Y0 = [N - I0; I0; 0]; % Initial conditions for S, I, R
% Time span
tmax1 = 100; % Define the maximum time (adjust as needed)
tspan = [0 tmax1];
% Solve the SIR model differential equations
[t, Y] = ode45(sir_eqns, tspan, Y0);
% Plot the results
figure;
plot(t, Y(:,1), 'b', t, Y(:,2), 'r', t, Y(:,3), 'g');
legend('Susceptible', 'Infected', 'Recovered');
xlabel('Time');
ylabel('Population');
title('SIR Model');
axis tight;
grid on;
% Assuming t and Y are obtained from the ode45 solver for the SIR model
% Extract the infected population data (second column of Y)
infected = Y(:,2);
% Plot the infected population over time
figure;
plot(t, infected, 'r');
legend('Infected');
xlabel('Time');
ylabel('Population');
title('Infected Population over Time');
grid on;
The code provides a visual representation of how the disease spreads and eventually diminishes within the population over the specified time interval . It can be used to understand the impact of different parameters (such as infection and recovery rates) on the progression of the outbreak .
The study of nonlinear dynamical systems in lattices is an area of research with continuously growing interest.The first systematic studies of these systems emerged in the late 1930 s,thanks to the work of Frenkel and Kontorova on crystal dislocations.These studies led to the formulation of the discrete Klein-Gordon equation (DKG).Specifically,in 1939,Frenkel and Kontorova proposed a model that describes the structure and dynamics of a crystal lattice in a dislocation core.The FK model has become one of the fundamental models in physics,as it has been proven to reliably describe significant phenomena observed in discrete media.The equation we will examine is a variation of the following form:
The process described involves approximating a nonlinear differential equation through the Taylor method and simplifying it into a linear model.Let's analyze step by step the process from the initial equation to its final form.For small angles, can be approximated through the Taylor series as:
We substitute in the original equation with the Taylor approximation:
To map this equation to a linear model,we consider the angles to correspond to displacements in a mass-spring system.Thus,the equation transforms into:
We recognize that the term expresses the nonlinearity of the system,while β is a coefficient corresponding to this nonlinearity,simplifying the expression.The final form of the equation is:
The exact value of β depends on the mapping of coefficients in the Taylor approximation and its application to the specific physical problem.Our main goal is to derive results regarding stability and convergence in nonlinear lattices under nonlinear conditions.We will examine the basic characteristics of the discrete Klein-Gordon equation:
This model is often used to describe the opening of the DNA double helix during processes such as transcription.The model focuses on the transverse motion of the base pairs,which can be represented by a set of coupled nonlinear differential equations.
% Parameters
numBases = 50; % Number of base pairs
kappa = 0.1; % Elasticity constant
omegaD = 0.2; % Frequency term
beta = 0.05; % Nonlinearity coefficient
% Initial conditions
initialPositions = 0.01 + (0.02 - 0.01) * rand(numBases, 1);
initialVelocities = zeros(numBases, 1);
Time span
tSpan = [0 50];
>> % Differential equations
odeFunc = @(t, y) [y(numBases+1:end); ... % velocities
kappa * ([y(2); y(3:numBases); 0] - 2 * y(1:numBases) + [0; y(1:numBases-1)]) + ...
omegaD^2 * (y(1:numBases) - beta * y(1:numBases).^3)]; % accelerations
% Solve the system
[T, Y] = ode45(odeFunc, tSpan, [initialPositions; initialVelocities]);
% Visualization
plot(T, Y(:, 1:numBases))
legend(arrayfun(@(n) sprintf('Base %d', n), 1:numBases, 'UniformOutput', false))
xlabel('Time')
ylabel('Position')
title('Dynamics of DNA Base Pairs')
% Choose a specific time for the snapshot
snapshotTime = 10;
% Find the index in T that is closest to the snapshot time
[~, snapshotIndex] = min(abs(T - snapshotTime));
% Extract the solution at the snapshot time
snapshotSolution = Y(snapshotIndex, 1:numBases);
% Generate discrete plot for the DNA model at the snapshot time
figure;
stem(1:numBases, snapshotSolution, 'filled')
title(sprintf('DNA Model Displacement at t = %d', snapshotTime))
xlabel('Base Pair Index')
ylabel('Displacement')
% Time vector for detailed sampling
tDetailed = 0:0.5:50;
% Initialize an empty array to hold the data
data = [];
% Generate the data for 3D plotting
for i = 1:numBases
% Interpolate to get detailed solution data for each base pair
detailedSolution = interp1(T, Y(:, i), tDetailed);
% Concatenate the current base pair's data to the main data array
data = [data; repmat(i, length(tDetailed), 1), tDetailed', detailedSolution'];
end
% 3D Plot
figure;
scatter3(data(:,1), data(:,2), data(:,3), 10, data(:,3), 'filled')
xlabel('Base Pair')
ylabel('Time')
zlabel('Displacement')
title('3D Plot of DNA Base Pair Displacements Over Time')
colormap('rainbow')
colorbar
Hannah
Hannah
Last activity 2024 年 3 月 26 日

Lots of students like me have a break from school this week or next! If y'all are looking for something interesting to do learn a bit about using hgtransform by making the transforming snake animation in MATLAB!
Code below!
⬇️⬇️⬇️
numblock=24;
v = [ -1 -1 -1 ; 1 -1 -1 ; -1 1 -1 ; -1 1 1 ; -1 -1 1 ; 1 -1 1 ];
f = [ 1 2 3 nan; 5 6 4 nan; 1 2 6 5; 1 5 4 3; 3 4 6 2 ];
clr = hsv(numblock);
shapes = [ 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 % box
0 0 .5 -.5 .5 0 1 0 -.5 .5 -.5 0 1 0 .5 -.5 .5 0 1 0 -.5 .5 -.5 0 % fluer
0 0 1 1 0 .5 -.5 1 .5 .5 -.5 -.5 1 .5 .5 -.5 -.5 1 .5 .5 -.5 -.5 1 .5 % bowl
0 .5 -.5 -.5 .5 -.5 .5 .5 -.5 .5 -.5 -.5 .5 -.5 .5 .5 -.5 .5 -.5 -.5 .5 -.5 .5 .5]; % ball
% Build the assembly
set(gcf,'color','black');
daspect(newplot,[1 1 1]);
xform=@(R)makehgtform('axisrotate',[0 1 0],R,'zrotate',pi/2,'yrotate',pi,'translate',[2 0 0]);
P=hgtransform('Parent',gca,'Matrix',makehgtform('xrotate',pi*.5,'zrotate',pi*-.8));
for i = 1:numblock
P = hgtransform('Parent',P,'Matrix',xform(shapes(end,i)*pi));
patch('Parent',P, 'Vertices', v, 'Faces', f, 'FaceColor',clr(i,:),'EdgeColor','none');
patch('Parent',P, 'Vertices', v*.75, 'Faces', f(end,:), 'FaceColor','none',...
'EdgeColor','w','LineWidth',2);
end
view([10 60]);
axis tight vis3d off
camlight
% Setup vectors for animation
h=findobj(gca,'type','hgtransform')'; h=h(2:end);
r=shapes(end,:)*pi;
steps=100;
% Animate between different shapes
for si = 1:size(shapes,1)
sh = shapes(si,:)*pi;
diff = (sh-r)/steps;
% Animate to a new shape
for s=1:steps
arrayfun(@(tx)set(h(tx),'Matrix',xform(r(tx)+diff(tx)*s)),1:numblock);
view([s*360/steps 20]); drawnow();
end
r=sh;
for s=1:steps; view([s*360/steps 20]); drawnow(); end % finish rotate
end
Nikolaos
Nikolaos
Last activity 2024 年 2 月 29 日

I asked my question in the general forum and a few minutes later it was deleted. Perhaps this is a better place?
Rather than using my German regional forum (as I do not speak German), I want to ask questions in an international English-speaking forum. Presumably there should be an international English forum for everyone around the world, as English is the first or second language of everyone who has gone to school. Where is it?
Chen Lin
Chen Lin
Last activity 2024 年 2 月 10 日

Happy year of the dragon.

Hannah
Hannah
Last activity 2024 年 2 月 8 日

I was looking into the possibility of making a spin-to-win prize wheel in MATLAB. I was looking around, and if someone has made one before they haven't shared. A labeled colored spinning wheel, that would slow down and stop (or I would take just stopping) at a random spot each time. I would love any tips or links to helpful resources!
Many of the examples in the MATLAB documentation are extremely high quality articles, often worthy of attention in their own right. Time to start celebrating them! Today's is how to increase Image Resolution using deep learning
Can you see them?
Hannah
Hannah
Last activity 2024 年 2 月 8 日

I have been procrastinating on schoolwork by looking at all the amazing designs created in the last MATLAB Flipbook Mini Hack! They are just amazing. The voting is over but what are y'all's personal favorites? Mine is the flapping butterfly, it is for sure a creation I plan to share with others in the future!
Xiang Xu
Xiang Xu
Last activity 2024 年 3 月 11 日

Struct is an easy way to combine different types of variants. But now MATLAB supports classes well, and I think class is always a better alternative than struct. I can't find a single scenario that struct is necessary. There are many shortcomings using structs in a project, e.g. uncontrollable field names, unexamined values, etc. What's your opinion?
Umar Khan
Umar Khan
Last activity 2024 年 2 月 22 日

I am confused, is the matlab answer better or Julia’s?

David
David
Last activity 2024 年 7 月 15 日

Hello and a warm welcome to all! We're thrilled to have you visit our community. MATLAB Central is a place for learning, sharing, and connecting with others who share your passion for MATLAB and Simulink. To ensure you have the best experience, here are some tips to get you started:
  1. Read the Community Guidelines: Understanding our community standards is crucial. Please take a moment to familiarize yourself with them. Keep in mind that posts not adhering to these guidelines may be flagged by moderators or other community members.
  2. Ask Technical Questions at MATLAB Answers: If you have questions related to MathWorks products, head over to MATLAB Answers (new question form - Ask the community). It's the go-to spot for technical inquiries, with responses often provided within an hour, depending on the complexity of the question and volunteer availability. To increase your chances of a speedy reply, check out our tips on how to craft a good question (link to post on asking good questions).
  3. Choosing the Right Channel: We offer a variety of discussion channels tailored to different contexts. Select the one that best fits your post. If you're unsure, the General channel is always a safe bet. If you feel there's a need for a new channel, we encourage you to suggest it in the Ideas channel.
  4. Reporting Issues: If you encounter posts that violate our guidelines, please use the 🚩Flag/Report feature (found in the 3-dot menu) to bring them to our attention.
  5. Quality Control: We strive to maintain a high standard of discussion. Accounts that post spam or too much nonsense may be subject to moderation, which can include temporary suspensions or permanent bans.
  6. Share Your Ideas: Your feedback is invaluable. If you have suggestions on how we can improve the community or MathWorks products, the Ideas channel is the perfect place to voice your thoughts.
Enjoy yourself and have fun! We're committed to fostering a supportive and educational environment. Dive into discussions, share your expertise, and grow your knowledge. We're excited to see what you'll contribute to the community!
Have you ever used Live Tasks in MATLAB? MathWorks development team would like to get some feedback on your experience – what did you like and not like. Especially, if you know about it but don’t use it frequently, we would like to understand why?
Please tell us what you think by submitting your response to this form https://forms.office.com/r/ui1EGqAFDx
Mike Croucher
Mike Croucher
Last activity 2024 年 1 月 29 日

One of my colleauges, Michio, recently posted an implementation of Pong Wars in MATLAB
Making me wonder about variations. What might the resulting patterns look with differing numbers of balls? Different physics etc?
MathWorks just released three new courses on Coursera liseted below. If you work with image or video data and are wanting to incorporate deep learning techniques into your workflow, this is a great opporutnity. The course creators monitor the discussion forums, so you can ask questions and get feedback on your work. Below are links to the three courses and a quick description of a project you'll complete in each.
  1. Introduction to Computer Vision for Deep Learning. You'll train a classifier to classify images of people signing the American Sign Language alphabet.
  2. Deep Learning for Object Detection. Move from just classification to finding object locations. You'll train a model to find different types of parking available on the MathWorks campus.
  3. Advanced Deep Learning Techniques for Computer Vision. You'll train anomaly detection models for medical images and use AI-assisted labeling auto label images.
I just now discovered Discussions.
Can anyone provide insight into the intended difference between Discussions and Answers and what should be posted where?
Just scrolling through Discussions, I saw postst that seem more suitable Answers?
What exactly does Discussions bring to the table that wasn't already brought by Answers?
Maybe this question is more suitable for a Discussion ....